本文整理汇总了C#中RegionEndpoint类的典型用法代码示例。如果您正苦于以下问题:C# RegionEndpoint类的具体用法?C# RegionEndpoint怎么用?C# RegionEndpoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegionEndpoint类属于命名空间,在下文中一共展示了RegionEndpoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CognitoSyncManager
public CognitoSyncManager(CognitoAWSCredentials cognitoCredentials, RegionEndpoint endpoint)
: this(cognitoCredentials, new AmazonCognitoSyncConfig
{
RegionEndpoint = endpoint
})
{
}
示例2: GeneratePresignedUrl
/// <summary>
/// Generate a presigned URL based on a <see cref="SynthesizeSpeechRequest"/>.
/// </summary>
/// <param name="credentials">The credentials to use in the presigned URL.</param>
/// <param name="region">The region for the URL.</param>
/// <param name="request">The request to base the presigned URL on.</param>
/// <returns></returns>
public static string GeneratePresignedUrl(AWSCredentials credentials, RegionEndpoint region, SynthesizeSpeechRequest request)
{
if (credentials == null)
throw new ArgumentNullException("credentials");
if (region == null)
throw new ArgumentNullException("region");
if (request == null)
throw new ArgumentNullException("request");
// Marshall this request and prepare it to be signed
var marshaller = new SynthesizeSpeechRequestMarshaller();
var iRequest = marshaller.Marshall(request);
iRequest.UseQueryString = true;
iRequest.HttpMethod = HTTPGet;
iRequest.Endpoint = new UriBuilder(HTTPS, region.GetEndpointForService(PollyServiceName).Hostname).Uri;
iRequest.Parameters[XAmzExpires] = ((int)FifteenMinutes.TotalSeconds).ToString(CultureInfo.InvariantCulture);
if (request.IsSetLexiconNames())
{
var sortedLexiconNames = new List<string>(request.LexiconNames);
sortedLexiconNames.Sort(StringComparer.Ordinal);
iRequest.Parameters[LexiconNamesParameter] = JsonMapper.ToJson(sortedLexiconNames);
}
if (request.IsSetOutputFormat())
iRequest.Parameters["OutputFormat"] = request.OutputFormat.ToString();
if (request.IsSetSampleRate())
iRequest.Parameters["SampleRate"] = request.SampleRate.ToString();
if (request.IsSetText())
iRequest.Parameters["Text"] = request.Text;
if (request.IsSetTextType())
iRequest.Parameters["TextType"] = request.TextType.ToString();
if (request.IsSetVoiceId())
iRequest.Parameters["VoiceId"] = request.VoiceId;
var immutableCredentials = credentials.GetCredentials();
if (immutableCredentials.UseToken)
{
// Don't use HeaderKeys.XAmzSecurityTokenHeader because Polly treats this as case-sensitive
iRequest.Parameters["X-Amz-Security-Token"] = immutableCredentials.Token;
}
// Only the host header should be signed, and the signer adds that.
// So clear out headers.
iRequest.Headers.Clear();
// Create presigned URL and assign it
var signingResult = SynthesizeSpeechPresignedUrlSigner.SignSynthesizeSpeechRequest(iRequest, new RequestMetrics(),
immutableCredentials.AccessKey, immutableCredentials.SecretKey, PollyServiceName, region.SystemName);
var authorization = "&" + signingResult.ForQueryParameters;
return ComposeUrl(iRequest).AbsoluteUri + authorization;
}
示例3: DeliveryClient
/// <summary>
/// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.DeliveryClient"/> class.
/// </summary>
/// <param name="policyFactory">An instance of IDeliveryPolicyFactory. <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
/// <param name="maConfig">Mobile Analytics Manager configuration. <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.MobileAnalyticsManagerConfig"/></param>
/// <param name="clientContext">An instance of ClientContext. <see cref="Amazon.Runtime.Internal.ClientContext"/></param>
/// <param name="credentials">An instance of Credentials. <see cref="Amazon.Runtime.AWSCredentials"/></param>
/// <param name="regionEndPoint">Region endpoint. <see cref="Amazon.RegionEndpoint"/></param>
public DeliveryClient(IDeliveryPolicyFactory policyFactory, MobileAnalyticsManagerConfig maConfig, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint)
{
_policyFactory = policyFactory;
_deliveryPolicies = new List<IDeliveryPolicy>();
_deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
_clientContext = clientContext;
_appID = clientContext.AppID;
_maConfig = maConfig;
_eventStore = new SQLiteEventStore(maConfig);
#if PCL
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
#elif BCL
if (null == credentials && null == regionEndPoint)
{
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient();
}
else if (null == credentials)
{
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(regionEndPoint);
}
else if (null == regionEndPoint)
{
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials);
}
else
{
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
}
#endif
}
示例4: UseClient
internal void UseClient(ICoreAmazonS3 client, RegionEndpoint region)
{
if (this.clientsByRegion.ContainsKey(region.SystemName))
{
this.clientsByRegion.Remove(region.SystemName);
}
this.clientsByRegion.Add(region.SystemName, client);
}
示例5: GetOrCreateInstance
/// <summary>
/// Gets or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
/// creates new instance and returns it.
/// </summary>
/// <param name="appID">Amazon Mobile Analytics Application ID.</param>
/// <param name="regionEndpoint">Region endpoint.</param>
/// <returns>Mobile Analytics Manager instance. </returns>
public static MobileAnalyticsManager GetOrCreateInstance(string appID, RegionEndpoint regionEndpoint)
{
if (string.IsNullOrEmpty(appID))
throw new ArgumentNullException("appID");
if (null == regionEndpoint)
throw new ArgumentNullException("regionEndpoint");
return GetOrCreateInstanceHelper(appID, null, regionEndpoint, null);
}
示例6: GetTransferUtility
internal TransferUtility GetTransferUtility(RegionEndpoint region)
{
TransferUtility output;
if (!this.transferUtilitiesByRegion.TryGetValue(region.SystemName, out output))
{
output = new TransferUtility(this.GetClient(region));
this.transferUtilitiesByRegion.Add(region.SystemName, output);
}
return output;
}
示例7: GetClient
internal AmazonS3Client GetClient(RegionEndpoint region)
{
AmazonS3Client output;
if (!this.clientsByRegion.TryGetValue(region.SystemName, out output))
{
output = new AmazonS3Client(this.credentials, this.config);
this.clientsByRegion.Add(region.SystemName, output);
}
return output;
}
示例8: UseClient
internal void UseClient(AmazonS3Client client, RegionEndpoint region)
{
if (this.clientsByRegion.ContainsKey(region.SystemName))
{
this.clientsByRegion.Remove(region.SystemName);
this.transferUtilitiesByRegion.Remove(region.SystemName);
}
this.clientsByRegion.Add(region.SystemName, client);
this.transferUtilitiesByRegion.Add(region.SystemName, new TransferUtility(client));
}
示例9: GetClient
internal ICoreAmazonS3 GetClient(RegionEndpoint region)
{
ICoreAmazonS3 output;
if (!this.clientsByRegion.TryGetValue(region.SystemName, out output))
{
output = ServiceClientHelpers.CreateServiceFromAssembly<ICoreAmazonS3>(ServiceClientHelpers.S3_ASSEMBLY_NAME, ServiceClientHelpers.S3_SERVICE_CLASS_NAME, this.ddbClient);
this.clientsByRegion.Add(region.SystemName, output);
}
return output;
}
示例10: DeliveryClient
/// <summary>
/// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.DeliveryClient"/> class.
/// </summary>
/// <param name="isDataAllowed">An instance of IDeliveryPolicyFactory <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
/// <param name="clientContext">An instance of ClientContext <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.ClientContext"/></param>
/// <param name="credentials">An instance of Credentials <see cref="Amazon.Runtime.AWSCredentials"/></param>
/// <param name="regionEndPoint">Region end point <see cref="Amazon.RegionEndpoint"/></param>
public DeliveryClient(IDeliveryPolicyFactory policyFactory, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint)
{
_policyFactory = policyFactory;
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
_clientContext = clientContext;
_appId = clientContext.Config.AppId;
_eventStore = new SQLiteEventStore(AWSConfigsMobileAnalytics.MaxDBSize, AWSConfigsMobileAnalytics.DBWarningThreshold);
_deliveryPolicies = new List<IDeliveryPolicy>();
_deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
_deliveryPolicies.Add(_policyFactory.NewBackgroundSubmissionPolicy());
}
示例11: GetOrCreateInstance
/// <summary>
/// Gets or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
/// creates new instance and returns it.
/// </summary>
/// <param name="appID">Amazon Mobile Analytics Application ID.</param>
/// <param name="credentials">AWS Credentials.</param>
/// <param name="regionEndpoint">Region endpoint.</param>
/// <returns>Mobile Analytics Manager instance.</returns>
public static MobileAnalyticsManager GetOrCreateInstance(string appID, AWSCredentials credentials, RegionEndpoint regionEndpoint)
{
if (string.IsNullOrEmpty(appID))
throw new ArgumentNullException("appID");
if (null == credentials)
throw new ArgumentNullException("credentials");
if (null == regionEndpoint)
throw new ArgumentNullException("regionEndpoint");
MobileAnalyticsManagerConfig maConfig = new MobileAnalyticsManagerConfig();
return GetOrCreateInstanceHelper(appID, credentials, regionEndpoint, maConfig);
}
示例12: DeleteImageArtifacts
/// <summary>
/// Deletes the image file artifacts associated with the specified conversion task.
/// If the task is still active, ignoreActiveTask must be set true to enable artifact
/// deletion, which will cause the task to fail. Use this option at your own risk.
/// </summary>
/// <param name="awsCredentials">
/// Credentials to use to instantiate the Amazon EC2 and Amazon S3 clients needed to
/// complete the operation.
/// </param>
/// <param name="region">
/// The region containing the bucket where the image file artifacts were stored
/// </param>
/// <param name="conversionTaskId">
/// The ID of the conversion task that used the image file
/// </param>
/// <param name="ignoreActiveTask">
/// If true the artifacts are deleted even if the conversion task is still in progress
/// </param>
/// <param name="progressCallback">Optional progress callback</param>
public static void DeleteImageArtifacts(AWSCredentials awsCredentials,
RegionEndpoint region,
string conversionTaskId,
bool ignoreActiveTask,
CleanupProgressCallback progressCallback)
{
DeleteImageArtifacts(new AmazonEC2Client(awsCredentials, region),
ServiceClientHelpers.CreateServiceFromAssembly<ICoreAmazonS3>(ServiceClientHelpers.S3_ASSEMBLY_NAME, ServiceClientHelpers.S3_SERVICE_CLASS_NAME, awsCredentials, region),
conversionTaskId,
ignoreActiveTask,
progressCallback);
}
示例13: DeliveryClient
/// <summary>
/// Constructor of <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.DeliveryClient"/> class.
/// </summary>
/// <param name="policyFactory">An instance of IDeliveryPolicyFactory <see cref="Amazon.MobileAnalytics.MobileAnalyticsManager.Internal.IDeliveryPolicyFactory"/></param>
/// <param name="maConfig"></param>
/// <param name="maManager"></param>
/// <param name="clientContext">An instance of ClientContext <see cref="Amazon.Runtime.Internal.ClientContext"/></param>
/// <param name="credentials">An instance of Credentials <see cref="Amazon.Runtime.AWSCredentials"/></param>
/// <param name="regionEndPoint">Region end point <see cref="Amazon.RegionEndpoint"/></param>
public DeliveryClient(IDeliveryPolicyFactory policyFactory, MobileAnalyticsManagerConfig maConfig, ClientContext clientContext, AWSCredentials credentials, RegionEndpoint regionEndPoint, MobileAnalyticsManager maManager)
{
_policyFactory = policyFactory;
_mobileAnalyticsLowLevelClient = new AmazonMobileAnalyticsClient(credentials, regionEndPoint);
_clientContext = clientContext;
_appID = clientContext.AppID;
_maConfig = maConfig;
_maManager = maManager;
_eventStore = new SQLiteEventStore(maConfig);
_deliveryPolicies = new List<IDeliveryPolicy>();
_deliveryPolicies.Add(_policyFactory.NewConnectivityPolicy());
}
示例14: DeleteImageArtifacts
/// <summary>
/// Deletes the image file artifacts associated with the specified conversion task.
/// If the task is still active, ignoreActiveTask must be set true to enable artifact
/// deletion, which will cause the task to fail. Use this option at your own risk.
/// </summary>
/// <param name="awsCredentials">
/// Credentials to use to instantiate the Amazon EC2 and Amazon S3 clients needed to
/// complete the operation.
/// </param>
/// <param name="region">
/// The region containing the bucket where the image file artifacts were stored
/// </param>
/// <param name="conversionTaskId">
/// The ID of the conversion task that used the image file
/// </param>
/// <param name="ignoreActiveTask">
/// If true the artifacts are deleted even if the conversion task is still in progress
/// </param>
/// <param name="progressCallback">Optional progress callback</param>
public static void DeleteImageArtifacts(AWSCredentials awsCredentials,
RegionEndpoint region,
string conversionTaskId,
bool ignoreActiveTask,
CleanupProgressCallback progressCallback)
{
DeleteImageArtifacts(new AmazonEC2Client(awsCredentials, region),
new AmazonS3Client(awsCredentials, region),
conversionTaskId,
ignoreActiveTask,
progressCallback);
}
示例15: GetOrCreateInstance
/// <summary>
/// Gets the or creates Mobile Analytics Manager instance. If the instance already exists, returns the instance; otherwise
/// creates new instance and returns it.
/// </summary>
/// <returns>Mobile Analytics Manager instance.</returns>
/// <param name="credentials">AWS Credentials.</param>
/// <param name="regionEndpoint">Region endpoint.</param>
/// <param name="appId">Amazon Mobile Analytics Application ID.</param>
public static MobileAnalyticsManager GetOrCreateInstance(AWSCredentials credential,
RegionEndpoint regionEndpoint,
string appId)
{
if (credential == null)
throw new ArgumentNullException("credential");
if (regionEndpoint == null)
throw new ArgumentNullException("regionEndpoint");
if (string.IsNullOrEmpty(appId))
throw new ArgumentNullException("appId");
return MobileAnalyticsManager.GetOrCreateInstanceHelper(appId, credential, regionEndpoint);
}