コード例 #1
0
        public HttpResponse DoAction <T>(AcsRequest <T> request, bool autoRetry,
                                         int maxRetryNumber, IClientProfile profile) where T : AcsResponse
        {
            if (null == profile)
            {
                throw new ClientException("SDK.InvalidProfile", "No active profile found.");
            }
            string regionId = profile.GetRegionId();

            if (null != request.RegionId)
            {
                regionId = request.RegionId;
            }
            Credential      credential = profile.GetCredential();
            ISigner         signer     = profile.GetSigner();
            FormatType?     format     = profile.GetFormat();
            List <Endpoint> endpoints  = null;

            if (request.ProductDomain == null)
            {
                endpoints = profile.GetEndpoints(regionId, request.Product, credential, request.LocationProduct, request.LocationEndpointType);
            }

            return(DoAction(request, autoRetry, maxRetryNumber, regionId, credential, signer, format, endpoints));
        }
コード例 #2
0
        public HttpResponse DoAction <T>(AcsRequest <T> request, bool autoRetry,
                                         int maxRetryNumber, IClientProfile profile) where T : AcsResponse
        {
            if (null == profile)
            {
                throw new ClientException("SDK.InvalidProfile", "No active profile found.");
            }
            bool   retry       = autoRetry;
            int    retryNumber = maxRetryNumber;
            String region      = profile.GetRegionId();

            if (null == request.RegionId)
            {
                request.RegionId = region;
            }

            AlibabaCloudCredentials credentials = credentialsProvider.GetCredentials();

            if (credentials == null)
            {
                credentials = new DefaultCredentialProvider().GetAlibabaCloudClientCredential();
            }
            Signer          signer = Signer.GetSigner(credentials);
            FormatType      format = profile.GetFormat();
            List <Endpoint> endpoints;

            endpoints = clientProfile.GetEndpoints(request.Product, request.RegionId,
                                                   request.LocationProduct,
                                                   request.LocationEndpointType);

            return(DoAction(request, retry, retryNumber, request.RegionId, credentials, signer, format, endpoints));
        }
コード例 #3
0
        public HttpResponse DoAction <T>(AcsRequest <T> request, bool autoRetry,
                                         int maxRetryNumber, IClientProfile profile) where T : AcsResponse
        {
            if (null == profile)
            {
                throw new ClientException("SDK.InvalidProfile", "No active profile found.");
            }
            var regionId   = profile.GetRegionId();
            var credential = profile.GetCredential();
            var signer     = profile.GetSigner();
            //FormatType format = profile.GetFormat();
            var endpoints = profile.GetEndpoints();

            return(DoAction(request, autoRetry, maxRetryNumber, regionId, credential, signer, endpoints));
        }
コード例 #4
0
        public async Task <HttpResponse> DoActionAsync <T>(AcsRequest <T> request, bool autoRetry, int maxRetryNumber, IClientProfile profile, CancellationToken cancellationToken) where T : AcsResponse
        {
            if (null == profile)
            {
                throw new ClientException("SDK.InvalidProfile", "No active profile found.");
            }

            var retry       = autoRetry;
            var retryNumber = maxRetryNumber;
            var region      = profile.GetRegionId();

            if (null == request.RegionId)
            {
                request.RegionId = region;
            }

            if (request.ProductDomain == null)
            {
                request.ProductDomain = EndpointUserConfig.GetProductDomain(request.Product, request.RegionId);
                if (request.ProductDomain == null)
                {
                    request.SetProductDomain();
                }
            }

            var credentials = await credentialsProvider.GetCredentialsAsync(cancellationToken).ConfigureAwait(false);

            if (credentials == null)
            {
                credentials = await new DefaultCredentialProvider().GetAlibabaCloudClientCredentialAsync(cancellationToken).ConfigureAwait(false);
            }

            var             signer    = Signer.GetSigner(credentials);
            var             format    = profile.GetFormat();
            List <Endpoint> endpoints = null;

            if (request.ProductDomain == null)
            {
                endpoints = await clientProfile.GetEndpointsAsync(request.Product, request.RegionId,
                                                                  request.LocationProduct,
                                                                  request.LocationEndpointType, cancellationToken).ConfigureAwait(false);
            }

            return(await DoActionAsync(request, retry, retryNumber, request.RegionId, credentials, signer, format, endpoints, cancellationToken).ConfigureAwait(false));
        }
コード例 #5
0
        public async Task <HttpResponse> DoActionAsync <T>(AcsRequest <T> request, bool autoRetry,
                                                           int maxRetryNumber, IClientProfile profile) where T : AcsResponse
        {
            if (null == profile)
            {
                throw new ClientException("SDK.InvalidProfile", "No active profile found.");
            }

            var regionId = profile.GetRegionId();

            if (null != request.RegionId)
            {
                regionId = request.RegionId;
            }

            var credential = profile.GetCredential();
            var signer     = profile.GetSigner();
            var format     = profile.GetFormat();
            var endpoints  = await profile.GetEndpointsAsync(regionId, request.Product, credential, request.LocationProduct);

            return(await DoActionAsync(request, autoRetry, maxRetryNumber, regionId, credential, signer, format, endpoints));
        }