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)); }
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)); }
public void GetSecurityToken() { IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret"); DefaultAcsClient client = new DefaultAcsClient(profile); var provider = new StaticCredentialsProvider(profile); CredentialsBackupCompatibilityAdaptor instance = new CredentialsBackupCompatibilityAdaptor(provider); Assert.Null(instance.GetSecurityToken()); profile = DefaultProfile.GetProfile("cn-shanghai", "accessKeyId", "accessKeySecret"); profile.GetCredential().SecurityToken = "some string"; client = new DefaultAcsClient(profile); provider = new StaticCredentialsProvider(profile); instance = new CredentialsBackupCompatibilityAdaptor(provider); Assert.NotNull(instance.GetSecurityToken()); }
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)); }