public void TestProductsWithLocationService()
        {
            var request = new DescribeRegionsRequest();
            DescribeRegionsResponse response = client.GetAcsResponse(request);

            Assert.True(0 < response.Regions.Count);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // The code provided will print ‘Hello World’ to the console.
            // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
            Console.WriteLine("Hello World!");
            // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app!

            var accessKeyId     = Environment.GetEnvironmentVariable("ACCESS_KEY_ID") ?? "AccessKeyId";
            var accessKeySecret = Environment.GetEnvironmentVariable("ACCESS_KEY_SECRET") ?? "AccessKeySecret";

            string         regionId = "cn-shanghai";
            IClientProfile profile  = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
            var            client   = new DefaultAcsClient(profile);

            var request = new DescribeRegionsRequest();

            try
            {
                var response = client.GetAcsResponse(request);
                Console.WriteLine(Encoding.Default.GetString(response.HttpResponse.Content));
            }
            catch (ClientException e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        public void TestProductsWithLocationService()
        {
            var request  = new DescribeRegionsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.True(0 < response.Regions.Count);
        }
        public void EcsHttpDebugTest()
        {
            Environment.SetEnvironmentVariable("DEBUG", "sdk");
            var request  = new DescribeRegionsRequest();
            var response = FeatureCommon.GetDefaultClient().GetAcsResponse(request);

            Assert.True(null != response.RequestId);
            Assert.Null(Environment.GetEnvironmentVariable("DEBUG"));
        }
        public void EcsHttpDebugTest()
        {
            Environment.SetEnvironmentVariable("DEBUG", "sdk");

            DescribeRegionsRequest  request  = new DescribeRegionsRequest();
            DescribeRegionsResponse response = client.GetAcsResponse(request);

            Assert.True(null != response.RequestId);
            Assert.Null(Environment.GetEnvironmentVariable("DEBUG"));
        }
Ejemplo n.º 6
0
        public void TestAddExistingEndpointManually()
        {
            var request    = new DescribeRegionsRequest();
            var profile    = DefaultProfile.GetProfile("cn-wenzhou", GetBasicAccessKeyId(), GetBasicAccessKeySecret());
            var testClient = new DefaultAcsClient(profile);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", "Ecs",
                                       "abc.cn-hangzhou.endpoint-test.exception.com");

            Assert.Throws <ClientException>(() => { testClient.GetAcsResponse(request); });
        }
Ejemplo n.º 7
0
        public void TestAddExistingEndpointManually()
        {
            var request = new DescribeRegionsRequest();

            var profile    = DefaultProfile.GetProfile("cn-wenzhou", FeatureTest.BasicAccessKeyId, FeatureTest.BasicAccessKeySecret);
            var testClient = new DefaultAcsClient(profile);

            profile.AddEndpoint("cn-hangzhou", "cn-hangzhou", "Ecs", "abc.cn-hangzhou.endpoint-test.exception.com");

            var response = testClient.GetAcsResponse(request);

            Assert.NotNull(response);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 此接口用于查询 TAT 产品后台地域列表。
        /// RegionState 为 AVAILABLE,代表该地域的 TAT 后台服务已经可用;未返回,代表该地域的 TAT 后台服务尚不可用。
        /// </summary>
        /// <param name="req"><see cref="DescribeRegionsRequest"/></param>
        /// <returns><see cref="DescribeRegionsResponse"/></returns>
        public DescribeRegionsResponse DescribeRegionsSync(DescribeRegionsRequest req)
        {
            JsonResponseModel <DescribeRegionsResponse> rsp = null;

            try
            {
                var strResp = this.InternalRequestSync(req, "DescribeRegions");
                rsp = JsonConvert.DeserializeObject <JsonResponseModel <DescribeRegionsResponse> >(strResp);
            }
            catch (JsonSerializationException e)
            {
                throw new TencentCloudSDKException(e.Message);
            }
            return(rsp.Response);
        }
Ejemplo n.º 9
0
        public void TestAddNewEndPointManually()
        {
            var profile    = DefaultProfile.GetProfile("cn-wenzhou", GetBasicAccessKeyId(), GetBasicAccessKeySecret());
            var testClient = new DefaultAcsClient(profile);

            var request = new DescribeRegionsRequest();

            var exceptionMsg = Assert.Throws <ClientException>(() =>
            {
                var response = testClient.GetAcsResponse(request);
            });

            Assert.Equal("Can not find endpoint to access.", exceptionMsg.ErrorMessage);

            DefaultProfile.AddEndpoint("cn-wenzhou", "cn-wenzhou", "Ecs", "abc.cn-wenzhou.endpoint-test.exception.com");

            Assert.Throws <ClientException>(() => { testClient.GetAcsResponse(request); });
        }
Ejemplo n.º 10
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonEC2Config config = new AmazonEC2Config();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonEC2Client client = new AmazonEC2Client(creds, config);

            DescribeRegionsResponse resp = new DescribeRegionsResponse();
            DescribeRegionsRequest  req  = new DescribeRegionsRequest
            {
            };

            resp = client.DescribeRegions(req);
            CheckError(resp.HttpStatusCode, "200");

            foreach (var obj in resp.Regions)
            {
                AddObject(obj);
            }
        }
Ejemplo n.º 11
0
 public async Task <DescribeRegionsResponse> DescribeRegionsAsync(DescribeRegionsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(await DescribeRegionsWithOptionsAsync(request, runtime));
 }
Ejemplo n.º 12
0
 public DescribeRegionsResponse DescribeRegions(DescribeRegionsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(DescribeRegionsWithOptions(request, runtime));
 }
Ejemplo n.º 13
0
 public async Task <DescribeRegionsResponse> DescribeRegionsWithOptionsAsync(DescribeRegionsRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
 {
     AlibabaCloud.TeaUtil.Common.ValidateModel(request);
     return(TeaModel.ToObject <DescribeRegionsResponse>(await DoRequestAsync("DescribeRegions", "HTTPS", "POST", "2020-01-11", "AK", null, request.ToMap(), runtime)));
 }
Ejemplo n.º 14
0
 public async Task <DescribeRegionsResponse> DescribeRegionsWithOptionsAsync(DescribeRegionsRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
 {
     AlibabaCloud.TeaUtil.Common.ValidateModel(request);
     return(TeaModel.ToObject <DescribeRegionsResponse>(await DoRequestAsync("2015-09-01", "HTTPS", "GET", "AK", "/regions", null, request.Headers, null, runtime)));
 }
Ejemplo n.º 15
0
 public DescribeRegionsResponse DescribeRegionsWithOptions(DescribeRegionsRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
 {
     AlibabaCloud.TeaUtil.Common.ValidateModel(request);
     return(TeaModel.ToObject <DescribeRegionsResponse>(DoRequest("DescribeRegions", "HTTPS", "POST", "2018-08-08", "AK", null, request.ToMap(), runtime)));
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Describe Regions
 /// </summary>
 /// <param name="request">Describe Regions  request</param>
 /// <returns>Describe Regions  Response from the service</returns>
 /// <remarks>
 /// The DescribeRegions operation describes regions zones that are currently available to the account.
 ///
 /// </remarks>
 public DescribeRegionsResponse DescribeRegions(DescribeRegionsRequest request)
 {
     return(Invoke <DescribeRegionsResponse>("DescribeRegionsResponse.xml"));
 }