• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AmazonCloudWatchAsyncClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient的典型用法代码示例。如果您正苦于以下问题:Java AmazonCloudWatchAsyncClient类的具体用法?Java AmazonCloudWatchAsyncClient怎么用?Java AmazonCloudWatchAsyncClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AmazonCloudWatchAsyncClient类属于com.amazonaws.services.cloudwatch包,在下文中一共展示了AmazonCloudWatchAsyncClient类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: S3BulkEventStore

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
public S3BulkEventStore(Metastore metastore, AWSConfig config, FieldDependencyBuilder.FieldDependency fieldDependency) {
    this.metastore = metastore;
    this.config = config;
    this.s3Client = new AmazonS3Client(config.getCredentials());
    s3Client.setRegion(config.getAWSRegion());
    if (config.getS3Endpoint() != null) {
        s3Client.setEndpoint(config.getS3Endpoint());
    }

    kinesis = new AmazonKinesisClient(config.getCredentials());
    kinesis.setRegion(config.getAWSRegion());
    if (config.getKinesisEndpoint() != null) {
        kinesis.setEndpoint(config.getKinesisEndpoint());
    }

    cloudWatchClient = new AmazonCloudWatchAsyncClient(config.getCredentials());
    cloudWatchClient.setRegion(config.getAWSRegion());

    this.conditionalMagicFieldsSize = fieldDependency.dependentFields.size();
}
 
开发者ID:rakam-io,项目名称:rakam,代码行数:21,代码来源:S3BulkEventStore.java


示例2: amazonCloudWatchAsync

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(AmazonCloudWatchAsyncClient.class)
public AmazonCloudWatchAsync amazonCloudWatchAsync(AWSCredentialsProvider credentialsProvider) {
    return AmazonCloudWatchAsyncClientBuilder.standard()
        .withCredentials(credentialsProvider)
        .build();
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:CloudWatchExportConfiguration.java


示例3: getAWSAsyncBillingClient

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
private AmazonCloudWatchAsyncClient getAWSAsyncBillingClient(AWSStatsDataHolder statsData) {
    statsData.billingClient = this.clientManager.getOrCreateCloudWatchClient(
            statsData.parentAuth,
            COST_ZONE_ID, this, statsData.statsRequest.isMockRequest,
            getFailureConsumer(statsData));
    return statsData.billingClient;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:AWSStatsService.java


示例4: getStatsAsyncClient

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
public static AmazonCloudWatchAsyncClient getStatsAsyncClient(
        AuthCredentialsServiceState credentials, String region,
        ExecutorService executorService, boolean isMockRequest) {

    ClientConfiguration configuration = new ClientConfiguration();
    configuration.withRetryPolicy(new RetryPolicy(new CustomRetryCondition(),
            DEFAULT_BACKOFF_STRATEGY,
            DEFAULT_MAX_ERROR_RETRY,
            false));

    AWSStaticCredentialsProvider awsStaticCredentialsProvider = new AWSStaticCredentialsProvider(
            new BasicAWSCredentials(credentials.privateKeyId,
                    EncryptionUtils.decrypt(credentials.privateKey)));

    AmazonCloudWatchAsyncClientBuilder amazonCloudWatchAsyncClientBuilder = AmazonCloudWatchAsyncClientBuilder
            .standard()
            .withClientConfiguration(configuration)
            .withCredentials(awsStaticCredentialsProvider)
            .withExecutorFactory(() -> executorService);

    if (region == null) {
        region = Regions.DEFAULT_REGION.getName();
    }

    if (isAwsClientMock()) {
        configuration.addHeader(AWS_REGION_HEADER, region);
        amazonCloudWatchAsyncClientBuilder.setClientConfiguration(configuration);
        AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
                getAWSMockHost() + AWS_MOCK_CLOUDWATCH_ENDPOINT, region);
        amazonCloudWatchAsyncClientBuilder.setEndpointConfiguration(endpointConfiguration);
    } else {
        amazonCloudWatchAsyncClientBuilder.setRegion(region);
    }

    return (AmazonCloudWatchAsyncClient) amazonCloudWatchAsyncClientBuilder.build();
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:37,代码来源:AWSUtils.java


示例5: getOrCreateCloudWatchClient

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
/**
 * Get or create a CloudWatch Client instance that will be used to get stats from AWS.
 * @param credentials
 *         The auth credentials to be used for the client creation
 * @param regionId
 *         The region of the AWS client
 * @param service
 *         The stateless service for which the operation is being performed.
 * @param isMock
 *         Indicates if this a mock request
 * @return
 */
public AmazonCloudWatchAsyncClient getOrCreateCloudWatchClient(
        AuthCredentialsServiceState credentials,
        String regionId, StatelessService service, boolean isMock,
        Consumer<Throwable> failConsumer) {
    if (this.awsClientType != AwsClientType.CLOUD_WATCH) {
        throw new UnsupportedOperationException(
                "This client manager supports only AWS " + this.awsClientType + " clients.");
    }
    String cacheKey = createCredentialRegionCacheKey(credentials, regionId);
    if (isCloudWatchClientInvalid(cacheKey)) {
        failConsumer.accept(
                new IllegalStateException("Invalid cloud watch client for key: " + cacheKey));
        return null;
    }
    AmazonCloudWatchAsyncClient amazonCloudWatchClient = null;
    try {
        amazonCloudWatchClient = this.cloudWatchClientCache.computeIfAbsent(cacheKey, key -> {
            AmazonCloudWatchAsyncClient client = AWSUtils.getStatsAsyncClient
                    (credentials, regionId, getExecutor(), isMock);
            client.describeAlarmsAsync(
                    new AsyncHandler<DescribeAlarmsRequest, DescribeAlarmsResult>() {
                        @Override
                        public void onError(Exception exception) {
                            markCloudWatchClientInvalid(service, cacheKey);
                        }

                        @Override
                        public void onSuccess(DescribeAlarmsRequest request,
                                DescribeAlarmsResult result) {
                            //noop
                        }
                    });
            return client;
        });
    } catch (Throwable e) {
        service.logSevere(e);
        failConsumer.accept(e);
    }
    return amazonCloudWatchClient;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:53,代码来源:AWSClientManager.java


示例6: initReporter

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
protected void initReporter(AWSCredentials awsCredentials) {
    final AmazonCloudWatchAsyncClient cloudWatchClient = new AmazonCloudWatchAsyncClient(awsCredentials);
    cloudWatchClient.setEndpoint(settings.endPoint);
    //start cloudwatch reporting
    new CloudWatchReporter(
            metricRegistry,
            settings.cloudWatchNamespace,
            cloudWatchClient
    ).start(settings.reportInterval, TimeUnit.SECONDS);
}
 
开发者ID:mojn,项目名称:jmx-cloudwatch-reporter,代码行数:11,代码来源:ReporterAgent.java


示例7: getAWSAsyncStatsClient

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
private AmazonCloudWatchAsyncClient getAWSAsyncStatsClient(AWSStatsDataHolder statsData) {
    statsData.statsClient = this.clientManager.getOrCreateCloudWatchClient(statsData.parentAuth,
            statsData.computeDesc.description.regionId, this,
            statsData.statsRequest.isMockRequest, getFailureConsumer(statsData));
    return statsData.statsClient;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:AWSStatsService.java


示例8: cloudwatchClient

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
@Bean
@Scope(WebApplicationContext.SCOPE_APPLICATION)
public AmazonCloudWatchAsyncClient cloudwatchClient(final AWSCredentialsProvider creds,
                                            final Region region) {
    return region.createClient(AmazonCloudWatchAsyncClient.class, creds, null);
}
 
开发者ID:awslabs,项目名称:amediamanager,代码行数:7,代码来源:ServerConfig.java


示例9: CloudWatchMetricsEmitter

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
public CloudWatchMetricsEmitter(String metricsNamespace,
		AWSCredentialsProvider credentials) {
	this.metricsNamespace = metricsNamespace;
	this.cloudWatchClient = new AmazonCloudWatchAsyncClient(credentials);
}
 
开发者ID:awslabs,项目名称:amazon-kinesis-aggregators,代码行数:6,代码来源:CloudWatchMetricsEmitter.java


示例10: build

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
/**
 * @return a new CloudWatchReporter instance based on the state of this builder
 */
public CloudWatchReporter build() {
    Preconditions.checkState(!Strings.isNullOrEmpty(namespace), "Metric namespace is required.");

    String resolvedNamespace = namespace;

    // Use specified or fall back to default. Don't secretly modify the fields of this builder
    // in case the caller wants to re-use it to build other reporters, or something.

    MetricRegistry resolvedRegistry = null != registry ? registry : new MetricRegistry();
    MetricFilter resolvedFilter = null != filter ? filter : MetricFilter.ALL;
    AmazonCloudWatchAsync resolvedCloudWatchClient = null != client ? client : new AmazonCloudWatchAsyncClient();
    String resolvedDimensions = null != dimensions ? dimensions : null;
    Boolean resolvedTimestampLocal = null != timestampLocal ? timestampLocal : false;

    String resolvedTypeDimName = null != typeDimName ? typeDimName : Constants.DEF_DIM_NAME_TYPE;
    String resolvedTypeDimValGauge = null != typeDimValGauge ? typeDimValGauge : Constants.DEF_DIM_VAL_GAUGE;
    String resolvedTypeDimValCounterCount = null != typeDimValCounterCount ? typeDimValCounterCount : Constants.DEF_DIM_VAL_COUNTER_COUNT;
    String resolvedTypeDimValMeterCount = null != typeDimValMeterCount ? typeDimValMeterCount : Constants.DEF_DIM_VAL_METER_COUNT;
    String resolvedTypeDimValHistoSamples = null != typeDimValHistoSamples ? typeDimValHistoSamples : Constants.DEF_DIM_VAL_HISTO_SAMPLES;
    String resolvedTypeDimValHistoStats = null != typeDimValHistoStats ? typeDimValHistoStats : Constants.DEF_DIM_VAL_HISTO_STATS;
    String resolvedTypeDimValTimerSamples = null != typeDimValTimerSamples ? typeDimValTimerSamples : Constants.DEF_DIM_VAL_TIMER_SAMPLES;
    String resolvedTypeDimValTimerStats = null != typeDimValTimerStats ? typeDimValTimerStats : Constants.DEF_DIM_VAL_TIMER_STATS;

    Predicate<MetricDatum> resolvedReporterFilter = null != reporterFilter ? reporterFilter : Predicates.<MetricDatum>alwaysTrue();

    return new CloudWatchReporter(
            resolvedRegistry,
            resolvedNamespace,
            resolvedFilter,
            resolvedCloudWatchClient)
            .withDimensions(resolvedDimensions)
            .withTimestampLocal(resolvedTimestampLocal)
            .withTypeDimName(resolvedTypeDimName)
            .withTypeDimValGauge(resolvedTypeDimValGauge)
            .withTypeDimValCounterCount(resolvedTypeDimValCounterCount)
            .withTypeDimValMeterCount(resolvedTypeDimValMeterCount)
            .withTypeDimValHistoSamples(resolvedTypeDimValHistoSamples)
            .withTypeDimValHistoStats(resolvedTypeDimValHistoStats)
            .withTypeDimValTimerSamples(resolvedTypeDimValTimerSamples)
            .withTypeDimValTimerStats(resolvedTypeDimValTimerStats)
            .withReporterFilter(resolvedReporterFilter);
}
 
开发者ID:blacklocus,项目名称:metrics-cloudwatch,代码行数:46,代码来源:CloudWatchReporterBuilder.java


示例11: initCloudWatch

import com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient; //导入依赖的package包/类
private void initCloudWatch(String keyId, String keySecret) {
    log.debug("Initializing CloudWatch Client");
    cloudWatch = new AmazonCloudWatchAsyncClient(new BasicAWSCredentials(keyId, keySecret));
}
 
开发者ID:Netflix,项目名称:s3mper,代码行数:5,代码来源:CloudWatchAlertDispatcher.java



注:本文中的com.amazonaws.services.cloudwatch.AmazonCloudWatchAsyncClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Repository类代码示例发布时间:2022-05-22
下一篇:
Java MFontConfiguration类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap