updateScraper method

Future<UpdateScraperResponse> updateScraper({
  1. required String scraperId,
  2. String? alias,
  3. String? clientToken,
  4. Destination? destination,
  5. RoleConfiguration? roleConfiguration,
  6. ScrapeConfiguration? scrapeConfiguration,
})

Updates an existing scraper.

You can't use this function to update the source from which the scraper is collecting metrics. To change the source, delete the scraper and create a new one.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter scraperId : The ID of the scraper to update.

Parameter alias : The new alias of the scraper.

Parameter clientToken : A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.

Parameter destination : The new Amazon Managed Service for Prometheus workspace to send metrics to.

Parameter roleConfiguration : Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.

Parameter scrapeConfiguration : Contains the base-64 encoded YAML configuration for the scraper.

Implementation

Future<UpdateScraperResponse> updateScraper({
  required String scraperId,
  String? alias,
  String? clientToken,
  Destination? destination,
  RoleConfiguration? roleConfiguration,
  ScrapeConfiguration? scrapeConfiguration,
}) async {
  final $payload = <String, dynamic>{
    if (alias != null) 'alias': alias,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (destination != null) 'destination': destination,
    if (roleConfiguration != null) 'roleConfiguration': roleConfiguration,
    if (scrapeConfiguration != null)
      'scrapeConfiguration': scrapeConfiguration,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/scrapers/${Uri.encodeComponent(scraperId)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateScraperResponse.fromJson(response);
}