|
|
@@ -0,0 +1,781 @@
|
|
|
+using Tea;
|
|
|
+using AlibabaCloud.SDK.Ecs20140526.Models;
|
|
|
+
|
|
|
+namespace molilian.core
|
|
|
+{
|
|
|
+
|
|
|
+ public partial class AliyunPlus
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ public DescribeNetworkInterfaceAttributeResponse DescribeNetworkInterfaceAttribute(string region, string networkInterfaceId)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ DescribeNetworkInterfaceAttributeRequest describeNetworkInterfaceAttributeRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ NetworkInterfaceId = networkInterfaceId,
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.DescribeNetworkInterfaceAttributeWithOptions(describeNetworkInterfaceAttributeRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 可以指定ResourceGroupId、VSwitchId、InstanceId等参数,查询一个或多个弹性网卡(ENI)的详细信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="networkInterfaceId"></param>
|
|
|
+ /// <param name="count"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public DescribeNetworkInterfacesResponse DescribeNetworkInterfaces(string region, string instanceId)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ InstanceId = instanceId,
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.DescribeNetworkInterfacesWithOptions(describeNetworkInterfacesRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 为一块弹性网卡分配一个或多个辅助私网IP地址。可以为网卡指定在所属交换机(vSwitch)的空闲私网IP地址,或者通过指定私网地址数量自动分配私网IP地址
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="networkInterfaceId"></param>
|
|
|
+ /// <param name="count"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public AssignPrivateIpAddressesResponse AssignPrivateIpAddresses(string region, string networkInterfaceId, int count)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ AssignPrivateIpAddressesRequest assignPrivateIpAddressesRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ NetworkInterfaceId = networkInterfaceId,
|
|
|
+ SecondaryPrivateIpAddressCount = count,
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.AssignPrivateIpAddressesWithOptions(assignPrivateIpAddressesRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 从一块弹性网卡删除一个或多个辅助私有IP地址
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="networkInterfaceId"></param>
|
|
|
+ /// <param name="privateIpAddress"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public UnassignPrivateIpAddressesResponse UnassignPrivateIpAddresses(string region, string networkInterfaceId, params string[] privateIpAddress)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ UnassignPrivateIpAddressesRequest unassignPrivateIpAddressesRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ NetworkInterfaceId = networkInterfaceId,
|
|
|
+ PrivateIpAddress = privateIpAddress.ToList(),
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.UnassignPrivateIpAddressesWithOptions(unassignPrivateIpAddressesRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 本接口用于查询一台指定ECS实例的属性信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="instanceId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public DescribeInstanceAttributeResponse DescribeInstanceAttribute(string region, string instanceId)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ DescribeInstanceAttributeRequest describeInstanceAttributeRequest = new()
|
|
|
+ {
|
|
|
+ InstanceId = instanceId
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.DescribeInstanceAttributeWithOptions(describeInstanceAttributeRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ /*
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 创建一张弹性网卡(ENI),支持指定主私网IP地址
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="vswitchId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public CreateNetworkInterfaceResponse CreateNetworkInterface(string region, string vswitchId, List<string> securityGroupId)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ CreateNetworkInterfaceRequest createNetworkInterfaceRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ VSwitchId = vswitchId,
|
|
|
+ SecurityGroupIds = securityGroupId
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.CreateNetworkInterfaceWithOptions(createNetworkInterfaceRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ /*
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 附加一个弹性网卡(ENI)到一台专有网络VPC类型ECS实例上
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <param name="instanceId"></param>
|
|
|
+ /// <param name="networkInterfaceId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public AttachNetworkInterfaceResponse AttachNetworkInterface(string region, string instanceId, string networkInterfaceId)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ AttachNetworkInterfaceRequest AttachNetworkInterfaceRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ NetworkInterfaceId = networkInterfaceId,
|
|
|
+ InstanceId = instanceId
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.AttachNetworkInterfaceWithOptions(AttachNetworkInterfaceRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ /*
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询实例的详细信息列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public DescribeInstancesResponse DescribeInstances(string region)
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+
|
|
|
+ DescribeInstancesRequest describeInstancesRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ };
|
|
|
+
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var response = client.DescribeInstancesWithOptions(describeInstancesRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (TeaException error)
|
|
|
+ {
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+
|
|
|
+ /*
|
|
|
+ {
|
|
|
+ "Instances": {
|
|
|
+ "Instance": [
|
|
|
+ {
|
|
|
+ "ResourceGroupId": "",
|
|
|
+ "Memory": 4096,
|
|
|
+ "InstanceChargeType": "PrePaid",
|
|
|
+ "Cpu": 2,
|
|
|
+ "OSName": "Alibaba Cloud Linux 3.2104 LTS 64位",
|
|
|
+ "InstanceNetworkType": "vpc",
|
|
|
+ "InnerIpAddress": {
|
|
|
+ "IpAddress": []
|
|
|
+ },
|
|
|
+ "ExpiredTime": "2025-04-09T16:00Z",
|
|
|
+ "ImageId": "aliyun_3_x64_20G_alibase_20240819.vhd",
|
|
|
+ "EipAddress": {
|
|
|
+ "Bandwidth": 200,
|
|
|
+ "AllocationId": "eip-2ze092o8df3jkykhjt5uw",
|
|
|
+ "IpAddress": "47.93.249.227",
|
|
|
+ "IsSupportUnassociate": true,
|
|
|
+ "InternetChargeType": "PayByTraffic"
|
|
|
+ },
|
|
|
+ "ImageOptions": {},
|
|
|
+ "HostName": "iZ2ze58hz63abqwi97eql5Z",
|
|
|
+ "VlanId": "",
|
|
|
+ "Status": "Running",
|
|
|
+ "HibernationOptions": {
|
|
|
+ "Configured": false
|
|
|
+ },
|
|
|
+ "MetadataOptions": {
|
|
|
+ "HttpTokens": "",
|
|
|
+ "HttpEndpoint": ""
|
|
|
+ },
|
|
|
+ "InstanceId": "i-2ze58hz63abqwi97eql5",
|
|
|
+ "StoppedMode": "Not-applicable",
|
|
|
+ "CpuOptions": {
|
|
|
+ "ThreadsPerCore": 2,
|
|
|
+ "Numa": "ON",
|
|
|
+ "CoreCount": 1
|
|
|
+ },
|
|
|
+ "StartTime": "2024-11-11T18:55Z",
|
|
|
+ "PrivateDnsNameOptions": {},
|
|
|
+ "DeletionProtection": false,
|
|
|
+ "SecurityGroupIds": {
|
|
|
+ "SecurityGroupId": [
|
|
|
+ "sg-2ze3ks3fd85brhe9c48x"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "VpcAttributes": {
|
|
|
+ "PrivateIpAddress": {
|
|
|
+ "IpAddress": [
|
|
|
+ "172.26.246.235"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "VpcId": "vpc-2zef23dd2ah5byvaampoh",
|
|
|
+ "VSwitchId": "vsw-2ze1l2p0nwulsib3baj22",
|
|
|
+ "NatIpAddress": ""
|
|
|
+ },
|
|
|
+ "InternetChargeType": "",
|
|
|
+ "InstanceName": "iZ2ze58hz63abqwi97eql5Z",
|
|
|
+ "DeploymentSetId": "",
|
|
|
+ "InternetMaxBandwidthOut": 0,
|
|
|
+ "SerialNumber": "a784fa00-704d-4061-958d-956e60ec37b6",
|
|
|
+ "OSType": "linux",
|
|
|
+ "CreationTime": "2024-04-09T04:28Z",
|
|
|
+ "AutoReleaseTime": "",
|
|
|
+ "Description": "",
|
|
|
+ "InstanceTypeFamily": "ecs.u1",
|
|
|
+ "DedicatedInstanceAttribute": {
|
|
|
+ "Tenancy": "",
|
|
|
+ "Affinity": ""
|
|
|
+ },
|
|
|
+ "PublicIpAddress": {
|
|
|
+ "IpAddress": []
|
|
|
+ },
|
|
|
+ "GPUSpec": "",
|
|
|
+ "NetworkInterfaces": {
|
|
|
+ "NetworkInterface": [
|
|
|
+ {
|
|
|
+ "Type": "Primary",
|
|
|
+ "PrimaryIpAddress": "172.26.246.235",
|
|
|
+ "MacAddress": "00:16:3e:37:f1:5e",
|
|
|
+ "NetworkInterfaceId": "eni-2ze3ks3fd85brff1j4av",
|
|
|
+ "PrivateIpSets": {
|
|
|
+ "PrivateIpSet": [
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.235",
|
|
|
+ "Primary": true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "Type": "Secondary",
|
|
|
+ "PrimaryIpAddress": "172.26.246.236",
|
|
|
+ "MacAddress": "00:16:3e:3b:8e:f9",
|
|
|
+ "NetworkInterfaceId": "eni-2ze2bgtgn8187kti5xlk",
|
|
|
+ "PrivateIpSets": {
|
|
|
+ "PrivateIpSet": [
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.236",
|
|
|
+ "Primary": true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "SpotPriceLimit": 0,
|
|
|
+ "DeviceAvailable": true,
|
|
|
+ "SaleCycle": "",
|
|
|
+ "InstanceType": "ecs.u1-c1m2.large",
|
|
|
+ "SpotStrategy": "NoSpot",
|
|
|
+ "OSNameEn": "Alibaba Cloud Linux 3.2104 LTS 64 bit",
|
|
|
+ "IoOptimized": true,
|
|
|
+ "ZoneId": "cn-beijing-g",
|
|
|
+ "ClusterId": "",
|
|
|
+ "EcsCapacityReservationAttr": {
|
|
|
+ "CapacityReservationPreference": "",
|
|
|
+ "CapacityReservationId": ""
|
|
|
+ },
|
|
|
+ "DedicatedHostAttribute": {
|
|
|
+ "DedicatedHostId": "",
|
|
|
+ "DedicatedHostName": "",
|
|
|
+ "DedicatedHostClusterId": ""
|
|
|
+ },
|
|
|
+ "GPUAmount": 0,
|
|
|
+ "OperationLocks": {
|
|
|
+ "LockReason": []
|
|
|
+ },
|
|
|
+ "InternetMaxBandwidthIn": 100,
|
|
|
+ "Recyclable": false,
|
|
|
+ "RegionId": "cn-beijing",
|
|
|
+ "CreditSpecification": ""
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "TotalCount": 1,
|
|
|
+ "NextToken": "",
|
|
|
+ "PageSize": 10,
|
|
|
+ "RequestId": "EE630391-023A-511F-8368-09B48CA876CA",
|
|
|
+ "PageNumber": 1
|
|
|
+ } */
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 查询一个或多个弹性网卡(ENI)的详细信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="region"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public DescribeNetworkInterfacesResponse DescribeNetworkInterfaces(string region = "cn-beijing")
|
|
|
+ {
|
|
|
+ AlibabaCloud.OpenApiClient.Models.Config config = new()
|
|
|
+ {
|
|
|
+ AccessKeyId = _app_key,
|
|
|
+ AccessKeySecret = _app_secret,
|
|
|
+ Endpoint = $"ecs.{region}.aliyuncs.com"
|
|
|
+ };
|
|
|
+
|
|
|
+ AlibabaCloud.SDK.Ecs20140526.Client client = new(config);
|
|
|
+ DescribeNetworkInterfacesRequest describeNetworkInterfacesRequest = new()
|
|
|
+ {
|
|
|
+ RegionId = region,
|
|
|
+ };
|
|
|
+ AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ // 复制代码运行请自行打印 API 的返回值
|
|
|
+ var response = client.DescribeNetworkInterfacesWithOptions(describeNetworkInterfacesRequest, runtime);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+ catch (Exception _error)
|
|
|
+ {
|
|
|
+ TeaException error = new TeaException(new Dictionary<string, object>
|
|
|
+ {
|
|
|
+ { "message", _error.Message }
|
|
|
+ });
|
|
|
+ // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。
|
|
|
+ // 错误 message
|
|
|
+ Console.WriteLine(error.Message);
|
|
|
+ // 诊断地址
|
|
|
+ Console.WriteLine(error.Data["Recommend"]);
|
|
|
+ AlibabaCloud.TeaUtil.Common.AssertAsString(error.Message);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+
|
|
|
+ /*
|
|
|
+ {
|
|
|
+ "TotalCount": 2,
|
|
|
+ "NextToken": "AAAAAdDWBF2w6Olxc+cMPjUtUMqZeJtDdqvzzbLhu200mYNui74QNEqg9KVUarNzND4/xA==",
|
|
|
+ "PageSize": 10,
|
|
|
+ "RequestId": "E5C6E7D9-8A26-57EC-B7B0-7B04CF7AC822",
|
|
|
+ "PageNumber": 1,
|
|
|
+ "NetworkInterfaceSets": {
|
|
|
+ "NetworkInterfaceSet": [
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.236",
|
|
|
+ "ServiceManaged": false,
|
|
|
+ "DeleteOnRelease": true,
|
|
|
+ "ResourceGroupId": "",
|
|
|
+ "Attachment": {},
|
|
|
+ "NetworkInterfaceId": "eni-2ze2bgtgn8187kti5xlk",
|
|
|
+ "Ipv6Sets": {
|
|
|
+ "Ipv6Set": []
|
|
|
+ },
|
|
|
+ "OwnerId": 1903512636035761,
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "101.200.231.225"
|
|
|
+ },
|
|
|
+ "Status": "InUse",
|
|
|
+ "NetworkInterfaceTrafficMode": "Standard",
|
|
|
+ "ZoneId": "cn-beijing-g",
|
|
|
+ "InstanceId": "i-2ze58hz63abqwi97eql5",
|
|
|
+ "VSwitchId": "vsw-2ze1l2p0nwulsib3baj22",
|
|
|
+ "NetworkInterfaceName": "eni-20241111",
|
|
|
+ "MacAddress": "00:16:3e:3b:8e:f9",
|
|
|
+ "SecurityGroupIds": {
|
|
|
+ "SecurityGroupId": [
|
|
|
+ "sg-2ze3ks3fd85brhe9c48x"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "SourceDestCheck": false,
|
|
|
+ "Type": "Secondary",
|
|
|
+ "QueueNumber": 2,
|
|
|
+ "VpcId": "vpc-2zef23dd2ah5byvaampoh",
|
|
|
+ "Ipv6PrefixSets": {
|
|
|
+ "Ipv6PrefixSet": []
|
|
|
+ },
|
|
|
+ "CreationTime": "2024-11-11T08:43:05Z",
|
|
|
+ "Ipv4PrefixSets": {
|
|
|
+ "Ipv4PrefixSet": []
|
|
|
+ },
|
|
|
+ "PrivateIpSets": {
|
|
|
+ "PrivateIpSet": [
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.236",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "101.200.231.225"
|
|
|
+ },
|
|
|
+ "Primary": true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.245",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.95.11.84"
|
|
|
+ },
|
|
|
+ "Primary": false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.246",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "101.201.66.83"
|
|
|
+ },
|
|
|
+ "Primary": false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.243",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.93.9.144"
|
|
|
+ },
|
|
|
+ "Primary": false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.244",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.94.193.172"
|
|
|
+ },
|
|
|
+ "Primary": false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.247",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.95.194.86"
|
|
|
+ },
|
|
|
+ "Primary": false
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.235",
|
|
|
+ "ServiceManaged": false,
|
|
|
+ "DeleteOnRelease": true,
|
|
|
+ "ResourceGroupId": "",
|
|
|
+ "Attachment": {},
|
|
|
+ "NetworkInterfaceId": "eni-2ze3ks3fd85brff1j4av",
|
|
|
+ "Ipv6Sets": {
|
|
|
+ "Ipv6Set": []
|
|
|
+ },
|
|
|
+ "OwnerId": 1903512636035761,
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.93.249.227"
|
|
|
+ },
|
|
|
+ "Status": "InUse",
|
|
|
+ "NetworkInterfaceTrafficMode": "Standard",
|
|
|
+ "ZoneId": "cn-beijing-g",
|
|
|
+ "InstanceId": "i-2ze58hz63abqwi97eql5",
|
|
|
+ "VSwitchId": "vsw-2ze1l2p0nwulsib3baj22",
|
|
|
+ "MacAddress": "00:16:3e:37:f1:5e",
|
|
|
+ "SecurityGroupIds": {
|
|
|
+ "SecurityGroupId": [
|
|
|
+ "sg-2ze3ks3fd85brhe9c48x"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "Type": "Primary",
|
|
|
+ "QueueNumber": 2,
|
|
|
+ "VpcId": "vpc-2zef23dd2ah5byvaampoh",
|
|
|
+ "Ipv6PrefixSets": {
|
|
|
+ "Ipv6PrefixSet": []
|
|
|
+ },
|
|
|
+ "CreationTime": "2024-04-09T04:28:44Z",
|
|
|
+ "Ipv4PrefixSets": {
|
|
|
+ "Ipv4PrefixSet": []
|
|
|
+ },
|
|
|
+ "PrivateIpSets": {
|
|
|
+ "PrivateIpSet": [
|
|
|
+ {
|
|
|
+ "PrivateIpAddress": "172.26.246.235",
|
|
|
+ "AssociatedPublicIp": {
|
|
|
+ "PublicIpAddress": "47.93.249.227"
|
|
|
+ },
|
|
|
+ "Primary": true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ } */
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|