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

            Assert.True(0 < response.Regions.Count);
        }
Exemple #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);
            }
        }
Exemple #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"));
        }
Exemple #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); });
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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); });
        }
Exemple #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);
            }
        }
Exemple #11
0
 public async Task <DescribeRegionsResponse> DescribeRegionsAsync(DescribeRegionsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(await DescribeRegionsWithOptionsAsync(request, runtime));
 }
Exemple #12
0
 public DescribeRegionsResponse DescribeRegions(DescribeRegionsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(DescribeRegionsWithOptions(request, runtime));
 }
Exemple #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)));
 }
Exemple #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)));
 }
 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)));
 }
Exemple #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"));
 }