本文整理汇总了C#中Amazon.CloudWatch.AmazonCloudWatchConfig类的典型用法代码示例。如果您正苦于以下问题:C# AmazonCloudWatchConfig类的具体用法?C# AmazonCloudWatchConfig怎么用?C# AmazonCloudWatchConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AmazonCloudWatchConfig类属于Amazon.CloudWatch命名空间,在下文中一共展示了AmazonCloudWatchConfig类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AmazonCloudWatchClient
/// <summary>
/// Constructs AmazonCloudWatchClient with the credentials defined in the App.config.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSAccessKey" value="********************"/>
/// <add key="AWSSecretKey" value="****************************************"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonElasticBeanstalkClient Configuration Object</param>
public AmazonCloudWatchClient(AmazonCloudWatchConfig config)
: base(new EnvironmentAWSCredentials(), config, true, AuthenticationTypes.User)
{
}
示例2: CreateAmazonCloudWatchClient
/// <summary>
/// Create a client for the Amazon CloudWatch Service with the specified configuration
/// </summary>
/// <param name="awsAccessKey">The AWS Access Key associated with the account</param>
/// <param name="awsSecretAccessKey">The AWS Secret Access Key associated with the account</param>
/// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc
/// </param>
/// <returns>An Amazon CloudWatch client</returns>
/// <remarks>
/// </remarks>
public static IAmazonCloudWatch CreateAmazonCloudWatchClient(
string awsAccessKey,
string awsSecretAccessKey, AmazonCloudWatchConfig config
)
{
return new AmazonCloudWatchClient(awsAccessKey, awsSecretAccessKey, config);
}
示例3: AmazonCloudWatchClient
/// <summary>
/// Constructs AmazonCloudWatchClient with AWS Credentials and an
/// AmazonCloudWatchClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonCloudWatchClient Configuration Object</param>
public AmazonCloudWatchClient(AWSCredentials credentials, AmazonCloudWatchConfig clientConfig)
: base(credentials, clientConfig)
{
}
示例4: CreateAmazonCloudWatchClient
/// <summary>
/// Create a client for the Amazon CloudWatch Service with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSAccessKey" value="********************"/>
/// <add key="AWSSecretKey" value="****************************************"/>
/// </appSettings>
/// </configuration>
/// </code>
/// </summary>
/// <param name="config">Configuration options for the service like HTTP Proxy, # of connections, etc</param>
/// <returns>An Amazon CloudWatch client</returns>
public static AmazonCloudWatch CreateAmazonCloudWatchClient(AmazonCloudWatchConfig config)
{
return new AmazonCloudWatchClient(config);
}
示例5: AmazonCloudWatchClient
/// <summary>
/// Constructs AmazonCloudWatchClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonCloudWatchClient Configuration object. If the config object's
/// UseSecureStringForAwsSecretKey is false, the AWS Secret Key
/// is stored as a clear-text string. Please use this option only
/// if the application environment doesn't allow the use of SecureStrings.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonCloudWatchClient Configuration Object</param>
public AmazonCloudWatchClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonCloudWatchConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig, AuthenticationTypes.User | AuthenticationTypes.Session)
{
}
示例6: AmazonCloudWatchClient
/// <summary>
/// Constructs AmazonCloudWatchClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSAccessKey" value="********************"/>
/// <add key="AWSSecretKey" value="****************************************"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonCloudWatch Configuration Object</param>
public AmazonCloudWatchClient(AmazonCloudWatchConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config, true, AuthenticationTypes.User)
{
}
示例7: CreateClient
private IAmazonCloudWatch CreateClient()
{
// Submit in the region that was specified in the config file.
AmazonCloudWatchConfig config = new AmazonCloudWatchConfig()
{
RegionEndpoint = Amazon.RegionEndpoint.GetBySystemName(_regionName)
};
return new AmazonCloudWatchClient(config);
}
示例8: SetupClient
private void SetupClient()
{
if (_client != null)
return;
AmazonCloudWatchConfig cloudWatchConfig = null;
RegionEndpoint regionEndpoint = null;
if (string.IsNullOrEmpty(EndPoint) && ConfigurationManager.AppSettings["AWSServiceEndpoint"] != null)
EndPoint = ConfigurationManager.AppSettings["AWSServiceEndpoint"];
if (string.IsNullOrEmpty(AccessKey) && ConfigurationManager.AppSettings["AWSAccessKey"] != null)
AccessKey = ConfigurationManager.AppSettings["AWSAccessKey"];
if (string.IsNullOrEmpty(Secret) && ConfigurationManager.AppSettings["AWSSecretKey"] != null)
Secret = ConfigurationManager.AppSettings["AWSSecretKey"];
_client = AWSClientFactory.CreateAmazonCloudWatchClient(AccessKey, Secret);
try
{
if (!string.IsNullOrEmpty(EndPoint))
{
if (EndPoint.StartsWith("http"))
{
cloudWatchConfig = new AmazonCloudWatchConfig { ServiceURL = EndPoint };
if (string.IsNullOrEmpty(AccessKey))
_client = AWSClientFactory.CreateAmazonCloudWatchClient(cloudWatchConfig);
}
else
{
regionEndpoint = RegionEndpoint.GetBySystemName(EndPoint);
if (string.IsNullOrEmpty(AccessKey))
_client = AWSClientFactory.CreateAmazonCloudWatchClient(regionEndpoint);
}
}
}
catch (AmazonServiceException)
{
}
if (!string.IsNullOrEmpty(AccessKey))
if (regionEndpoint != null)
_client = AWSClientFactory.CreateAmazonCloudWatchClient(AccessKey, Secret, regionEndpoint);
else if (cloudWatchConfig != null)
_client = AWSClientFactory.CreateAmazonCloudWatchClient(AccessKey, Secret, cloudWatchConfig);
else
_client = AWSClientFactory.CreateAmazonCloudWatchClient(AccessKey, Secret);
//Debug
var metricDatum = new Amazon.CloudWatch.Model.MetricDatum().WithMetricName("CloudWatchAppender").WithValue(1).WithUnit("Count");
//_client.PutMetricData(new PutMetricDataRequest().WithNamespace("CloudWatchAppender").WithMetricData(metricDatum));
}
示例9: CreateClient
private AmazonCloudWatch CreateClient()
{
// Submit in the region that the instance is local to
var config = new AmazonCloudWatchConfig
{
ServiceURL = String.Format("http://monitoring.{0}.amazonaws.com", _region)
};
return new AmazonCloudWatchClient(_amazonAccessKeyId, _amazonSecretAccessKey, config);
}