diff --git a/clients/client-amp/README.md b/clients/client-amp/README.md index fb19be40ec832..1b326f34c36a7 100644 --- a/clients/client-amp/README.md +++ b/clients/client-amp/README.md @@ -27,7 +27,7 @@ workspace.

## Installing -To install the this package, simply type add or install @aws-sdk/client-amp +To install this package, simply type add or install @aws-sdk/client-amp using your favorite package manager: - `npm install @aws-sdk/client-amp` @@ -419,6 +419,14 @@ UpdateLoggingConfiguration [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/amp/command/UpdateLoggingConfigurationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-amp/Interface/UpdateLoggingConfigurationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-amp/Interface/UpdateLoggingConfigurationCommandOutput/) + +
+ +UpdateScraper + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/amp/command/UpdateScraperCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-amp/Interface/UpdateScraperCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-amp/Interface/UpdateScraperCommandOutput/) +
diff --git a/clients/client-amp/src/Amp.ts b/clients/client-amp/src/Amp.ts index 25fcd53c3ed51..7432be0f16b58 100644 --- a/clients/client-amp/src/Amp.ts +++ b/clients/client-amp/src/Amp.ts @@ -124,6 +124,11 @@ import { UpdateLoggingConfigurationCommandInput, UpdateLoggingConfigurationCommandOutput, } from "./commands/UpdateLoggingConfigurationCommand"; +import { + UpdateScraperCommand, + UpdateScraperCommandInput, + UpdateScraperCommandOutput, +} from "./commands/UpdateScraperCommand"; import { UpdateWorkspaceAliasCommand, UpdateWorkspaceAliasCommandInput, @@ -156,6 +161,7 @@ const commands = { TagResourceCommand, UntagResourceCommand, UpdateLoggingConfigurationCommand, + UpdateScraperCommand, UpdateWorkspaceAliasCommand, }; @@ -547,6 +553,17 @@ export interface Amp { cb: (err: any, data?: UpdateLoggingConfigurationCommandOutput) => void ): void; + /** + * @see {@link UpdateScraperCommand} + */ + updateScraper(args: UpdateScraperCommandInput, options?: __HttpHandlerOptions): Promise; + updateScraper(args: UpdateScraperCommandInput, cb: (err: any, data?: UpdateScraperCommandOutput) => void): void; + updateScraper( + args: UpdateScraperCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: UpdateScraperCommandOutput) => void + ): void; + /** * @see {@link UpdateWorkspaceAliasCommand} */ diff --git a/clients/client-amp/src/AmpClient.ts b/clients/client-amp/src/AmpClient.ts index 93f21911b37d8..d7c81534ff040 100644 --- a/clients/client-amp/src/AmpClient.ts +++ b/clients/client-amp/src/AmpClient.ts @@ -123,6 +123,7 @@ import { UpdateLoggingConfigurationCommandInput, UpdateLoggingConfigurationCommandOutput, } from "./commands/UpdateLoggingConfigurationCommand"; +import { UpdateScraperCommandInput, UpdateScraperCommandOutput } from "./commands/UpdateScraperCommand"; import { UpdateWorkspaceAliasCommandInput, UpdateWorkspaceAliasCommandOutput, @@ -167,6 +168,7 @@ export type ServiceInputTypes = | TagResourceCommandInput | UntagResourceCommandInput | UpdateLoggingConfigurationCommandInput + | UpdateScraperCommandInput | UpdateWorkspaceAliasCommandInput; /** @@ -198,6 +200,7 @@ export type ServiceOutputTypes = | TagResourceCommandOutput | UntagResourceCommandOutput | UpdateLoggingConfigurationCommandOutput + | UpdateScraperCommandOutput | UpdateWorkspaceAliasCommandOutput; /** diff --git a/clients/client-amp/src/commands/CreateScraperCommand.ts b/clients/client-amp/src/commands/CreateScraperCommand.ts index 9e2cc8b3e41aa..1eae26792a7b7 100644 --- a/clients/client-amp/src/commands/CreateScraperCommand.ts +++ b/clients/client-amp/src/commands/CreateScraperCommand.ts @@ -30,20 +30,20 @@ export interface CreateScraperCommandOutput extends CreateScraperResponse, __Met /** *

The CreateScraper operation creates a scraper to collect metrics. A * scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS - * cluster, and sends them to your Amazon Managed Service for Prometheus workspace. You can configure the - * scraper to control what metrics are collected, and what transformations are applied - * prior to sending them to your workspace.

- *

If needed, an IAM role will be created for you that gives Amazon Managed Service for Prometheus access to the metrics in your cluster. For more information, see - * Using roles for scraping metrics from EKS in the Amazon Managed Service for Prometheus User - * Guide.

- *

You cannot update a scraper. If you want to change the configuration of the scraper, - * create a new scraper and delete the old one.

- *

The scrapeConfiguration parameter contains the base64-encoded version of - * the YAML configuration file.

+ * cluster, and sends them to your Amazon Managed Service for Prometheus workspace. Scrapers are + * flexible, and can be configured to control what metrics are collected, the + * frequency of collection, what transformations are applied to the metrics, and more.

+ *

An IAM role will be created for you that Amazon Managed Service for Prometheus uses + * to access the metrics in your cluster. You must configure this role with a policy that + * allows it to scrape metrics from your cluster. For more information, see + * Configuring your Amazon EKS cluster in the Amazon Managed Service for Prometheus User Guide.

+ *

The scrapeConfiguration parameter contains the base-64 encoded YAML + * configuration for the scraper.

* *

For more information about collectors, including what metrics are collected, and - * how to configure the scraper, see Amazon Web Services managed - * collectors in the Amazon Managed Service for Prometheus User + * how to configure the scraper, see Using an + * Amazon Web Services managed + * collector in the Amazon Managed Service for Prometheus User * Guide.

*
* @example diff --git a/clients/client-amp/src/commands/ListTagsForResourceCommand.ts b/clients/client-amp/src/commands/ListTagsForResourceCommand.ts index 1f06cfc537623..410db237fd9bb 100644 --- a/clients/client-amp/src/commands/ListTagsForResourceCommand.ts +++ b/clients/client-amp/src/commands/ListTagsForResourceCommand.ts @@ -30,7 +30,7 @@ export interface ListTagsForResourceCommandOutput extends ListTagsForResourceRes /** *

The ListTagsForResource operation returns the tags that are associated * with an Amazon Managed Service for Prometheus resource. Currently, the only resources that can be - * tagged are workspaces and rule groups namespaces.

+ * tagged are scrapers, workspaces, and rule groups namespaces.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-amp/src/commands/TagResourceCommand.ts b/clients/client-amp/src/commands/TagResourceCommand.ts index 66bd85916f3b0..91a899887bde5 100644 --- a/clients/client-amp/src/commands/TagResourceCommand.ts +++ b/clients/client-amp/src/commands/TagResourceCommand.ts @@ -29,12 +29,12 @@ export interface TagResourceCommandOutput extends TagResourceResponse, __Metadat /** *

The TagResource operation associates tags with an Amazon Managed Service for Prometheus - * resource. The only resources that can be tagged are workspaces and rule groups - * namespaces.

+ * resource. The only resources that can be tagged are rule groups namespaces, scrapers, + * and workspaces.

*

If you specify a new tag key for the resource, this tag is appended to the list of * tags associated with the resource. If you specify a tag key that is already associated * with the resource, the new tag value that you specify replaces the previous value for - * that tag.

+ * that tag. To remove a tag, use UntagResource.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-amp/src/commands/UntagResourceCommand.ts b/clients/client-amp/src/commands/UntagResourceCommand.ts index 707201815dc90..00ecf1c6cdeb1 100644 --- a/clients/client-amp/src/commands/UntagResourceCommand.ts +++ b/clients/client-amp/src/commands/UntagResourceCommand.ts @@ -29,7 +29,7 @@ export interface UntagResourceCommandOutput extends UntagResourceResponse, __Met /** *

Removes the specified tags from an Amazon Managed Service for Prometheus resource. The only resources - * that can be tagged are workspaces and rule groups namespaces.

+ * that can be tagged are rule groups namespaces, scrapers, and workspaces.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-amp/src/commands/UpdateScraperCommand.ts b/clients/client-amp/src/commands/UpdateScraperCommand.ts new file mode 100644 index 0000000000000..86a79fabda0bc --- /dev/null +++ b/clients/client-amp/src/commands/UpdateScraperCommand.ts @@ -0,0 +1,134 @@ +// smithy-typescript generated code +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; +import { getSerdePlugin } from "@smithy/middleware-serde"; +import { Command as $Command } from "@smithy/smithy-client"; +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; + +import { AmpClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../AmpClient"; +import { commonParams } from "../endpoint/EndpointParameters"; +import { UpdateScraperRequest, UpdateScraperResponse } from "../models/models_0"; +import { de_UpdateScraperCommand, se_UpdateScraperCommand } from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export type { __MetadataBearer }; +export { $Command }; +/** + * @public + * + * The input for {@link UpdateScraperCommand}. + */ +export interface UpdateScraperCommandInput extends UpdateScraperRequest {} +/** + * @public + * + * The output of {@link UpdateScraperCommand}. + */ +export interface UpdateScraperCommandOutput extends UpdateScraperResponse, __MetadataBearer {} + +/** + *

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.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { AmpClient, UpdateScraperCommand } from "@aws-sdk/client-amp"; // ES Modules import + * // const { AmpClient, UpdateScraperCommand } = require("@aws-sdk/client-amp"); // CommonJS import + * const client = new AmpClient(config); + * const input = { // UpdateScraperRequest + * scraperId: "STRING_VALUE", // required + * alias: "STRING_VALUE", + * scrapeConfiguration: { // ScrapeConfiguration Union: only one key present + * configurationBlob: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("") + * }, + * destination: { // Destination Union: only one key present + * ampConfiguration: { // AmpConfiguration + * workspaceArn: "STRING_VALUE", // required + * }, + * }, + * clientToken: "STRING_VALUE", + * }; + * const command = new UpdateScraperCommand(input); + * const response = await client.send(command); + * // { // UpdateScraperResponse + * // scraperId: "STRING_VALUE", // required + * // arn: "STRING_VALUE", // required + * // status: { // ScraperStatus + * // statusCode: "STRING_VALUE", // required + * // }, + * // tags: { // TagMap + * // "": "STRING_VALUE", + * // }, + * // }; + * + * ``` + * + * @param UpdateScraperCommandInput - {@link UpdateScraperCommandInput} + * @returns {@link UpdateScraperCommandOutput} + * @see {@link UpdateScraperCommandInput} for command's `input` shape. + * @see {@link UpdateScraperCommandOutput} for command's `response` shape. + * @see {@link AmpClientResolvedConfig | config} for AmpClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient access to perform this action.

+ * + * @throws {@link ConflictException} (client fault) + *

The request would cause an inconsistent state.

+ * + * @throws {@link InternalServerException} (server fault) + *

An unexpected error occurred during the processing of the request.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

The request references a resources that doesn't exist.

+ * + * @throws {@link ServiceQuotaExceededException} (client fault) + *

Completing the request would cause a service quota to be exceeded.

+ * + * @throws {@link ThrottlingException} (client fault) + *

The request was denied due to request throttling.

+ * + * @throws {@link ValidationException} (client fault) + *

The input fails to satisfy the constraints specified by an Amazon Web Services + * service.

+ * + * @throws {@link AmpServiceException} + *

Base exception class for all service exceptions from Amp service.

+ * + * @public + */ +export class UpdateScraperCommand extends $Command + .classBuilder< + UpdateScraperCommandInput, + UpdateScraperCommandOutput, + AmpClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep(commonParams) + .m(function (this: any, Command: any, cs: any, config: AmpClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AmazonPrometheusService", "UpdateScraper", {}) + .n("AmpClient", "UpdateScraperCommand") + .f(void 0, void 0) + .ser(se_UpdateScraperCommand) + .de(de_UpdateScraperCommand) + .build() { + /** @internal type navigation helper, not in runtime. */ + protected declare static __types: { + api: { + input: UpdateScraperRequest; + output: UpdateScraperResponse; + }; + sdk: { + input: UpdateScraperCommandInput; + output: UpdateScraperCommandOutput; + }; + }; +} diff --git a/clients/client-amp/src/commands/index.ts b/clients/client-amp/src/commands/index.ts index 272d6d0f58944..f748c67e32a22 100644 --- a/clients/client-amp/src/commands/index.ts +++ b/clients/client-amp/src/commands/index.ts @@ -24,4 +24,5 @@ export * from "./PutRuleGroupsNamespaceCommand"; export * from "./TagResourceCommand"; export * from "./UntagResourceCommand"; export * from "./UpdateLoggingConfigurationCommand"; +export * from "./UpdateScraperCommand"; export * from "./UpdateWorkspaceAliasCommand"; diff --git a/clients/client-amp/src/models/models_0.ts b/clients/client-amp/src/models/models_0.ts index 2b49b50832bc5..5e27eab527559 100644 --- a/clients/client-amp/src/models/models_0.ts +++ b/clients/client-amp/src/models/models_0.ts @@ -404,7 +404,8 @@ export interface DescribeAlertManagerDefinitionRequest { } /** - *

The details of an alert manager definition.

+ *

The details of an alert manager definition. It is the configuration for the + * alert manager, including information about receivers for routing alerts.

* @public */ export interface AlertManagerDefinitionDescription { @@ -510,7 +511,7 @@ export interface GetDefaultScraperConfigurationResponse { */ export interface ListTagsForResourceRequest { /** - *

The ARN of the resource to list tages for. Must be a workspace or rule groups + *

The ARN of the resource to list tages for. Must be a workspace, scraper, or rule groups * namespace resource.

* @public */ @@ -552,7 +553,7 @@ export type Destination = Destination.AmpConfigurationMember | Destination.$Unkn */ export namespace Destination { /** - *

The Amazon Managed Service for Prometheusworkspace to send metrics to.

+ *

The Amazon Managed Service for Prometheus workspace to send metrics to.

* @public */ export interface AmpConfigurationMember { @@ -580,7 +581,7 @@ export namespace Destination { } /** - *

A scrape configuration for a scraper, base 64 encoded. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User + *

A scrape configuration for a scraper, base 64 encoded. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User * Guide.

* @public */ @@ -687,14 +688,14 @@ export namespace Source { */ export interface CreateScraperRequest { /** - *

(optional) a name to associate with the scraper. This is for your use, and does not + *

(optional) An alias to associate with the scraper. This is for your use, and does not * need to be unique.

* @public */ alias?: string; /** - *

The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User + *

The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User * Guide.

* @public */ @@ -751,6 +752,14 @@ export const ScraperStatusCode = { * Scraper deletion failed. */ DELETION_FAILED: "DELETION_FAILED", + /** + * Scraper update failed. + */ + UPDATE_FAILED: "UPDATE_FAILED", + /** + * Scraper is being updated. Deletion is disallowed until status is ACTIVE. + */ + UPDATING: "UPDATING", } as const; /** @@ -863,13 +872,14 @@ export interface ScraperDescription { alias?: string; /** - *

The ID of the scraper.

+ *

The ID of the scraper. For example, s-example1-1234-abcd-5678-ef9012abcd34.

* @public */ scraperId: string | undefined; /** - *

The Amazon Resource Name (ARN) of the scraper.

+ *

The Amazon Resource Name (ARN) of the scraper. For example, + * arn:aws:aps:<region>:123456798012:scraper/s-example1-1234-abcd-5678-ef9012abcd34.

* @public */ arn: string | undefined; @@ -877,6 +887,7 @@ export interface ScraperDescription { /** *

The Amazon Resource Name (ARN) of the IAM role that provides * permissions for the scraper to discover and collect metrics on your behalf.

+ *

For example, arn:aws:iam::123456789012:role/service-role/AmazonGrafanaServiceRole-12example.

* @public */ roleArn: string | undefined; @@ -912,7 +923,7 @@ export interface ScraperDescription { statusReason?: string; /** - *

The configuration file in use by the scraper.

+ *

The configuration in use by the scraper.

* @public */ scrapeConfiguration: ScrapeConfiguration | undefined; @@ -1078,19 +1089,89 @@ export interface ListScrapersResponse { nextToken?: string; } +/** + * @public + */ +export interface UpdateScraperRequest { + /** + *

The ID of the scraper to update.

+ * @public + */ + scraperId: string | undefined; + + /** + *

The new alias of the scraper.

+ * @public + */ + alias?: string; + + /** + *

Contains the base-64 encoded YAML configuration for the scraper.

+ * + *

For more information about configuring a scraper, see Using an + * Amazon Web Services managed collector in the Amazon Managed Service for Prometheus + * User Guide.

+ *
+ * @public + */ + scrapeConfiguration?: ScrapeConfiguration; + + /** + *

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

+ * @public + */ + destination?: Destination; + + /** + *

A unique identifier that you can provide to ensure the idempotency of the request. + * Case-sensitive.

+ * @public + */ + clientToken?: string; +} + +/** + * @public + */ +export interface UpdateScraperResponse { + /** + *

The ID of the updated scraper.

+ * @public + */ + scraperId: string | undefined; + + /** + *

The Amazon Resource Name (ARN) of the updated scraper.

+ * @public + */ + arn: string | undefined; + + /** + *

A structure that displays the current status of the scraper.

+ * @public + */ + status: ScraperStatus | undefined; + + /** + *

The list of tag keys and values that are associated with the scraper.

+ * @public + */ + tags?: Record; +} + /** * @public */ export interface TagResourceRequest { /** - *

The ARN of the workspace or rule groups namespace to apply tags to.

+ *

The ARN of the resource to apply tags to.

* @public */ resourceArn: string | undefined; /** *

The list of tag keys and values to associate with the resource.

- *

Keys may not begin with aws:.

+ *

Keys must not begin with aws:.

* @public */ tags: Record | undefined; @@ -1106,7 +1187,7 @@ export interface TagResourceResponse {} */ export interface UntagResourceRequest { /** - *

The ARN of the workspace or rule groups namespace.

+ *

The ARN of the resource from which to remove a tag.

* @public */ resourceArn: string | undefined; @@ -1279,20 +1360,22 @@ export interface DescribeWorkspaceRequest { */ export interface WorkspaceDescription { /** - *

The unique ID for the workspace.

+ *

The unique ID for the workspace. For example, + * ws-example1-1234-abcd-5678-ef90abcd1234.

* @public */ workspaceId: string | undefined; /** - *

The alias that is assigned to this workspace to help identify it. It may not be - * unique.

+ *

The alias that is assigned to this workspace to help identify it. It does not need + * to be unique.

* @public */ alias?: string; /** - *

The ARN of the workspace.

+ *

The ARN of the workspace. For example, + * arn:aws:aps:<region>:123456789012:workspace/ws-example1-1234-abcd-5678-ef90abcd1234.

* @public */ arn: string | undefined; @@ -1304,7 +1387,8 @@ export interface WorkspaceDescription { status: WorkspaceStatus | undefined; /** - *

The Prometheus endpoint available for this workspace.

+ *

The Prometheus endpoint available for this workspace. For example, + * https://aps-workspaces.<region>.amazonaws.com/workspaces/ws-example1-1234-abcd-5678-ef90abcd1234/api/v1/.

* @public */ prometheusEndpoint?: string; @@ -1386,8 +1470,8 @@ export interface WorkspaceSummary { workspaceId: string | undefined; /** - *

The alias that is assigned to this workspace to help identify it. It may not be - * unique.

+ *

The alias that is assigned to this workspace to help identify it. It does not + * need to be unique.

* @public */ alias?: string; @@ -1457,7 +1541,7 @@ export interface CreateLoggingConfigurationRequest { /** *

The ARN of the CloudWatch log group to which the vended log data will be - * published. This log group must exist prior to calling this API.

+ * published. This log group must exist prior to calling this operation.

* @public */ logGroupArn: string | undefined; @@ -1569,7 +1653,7 @@ export interface DescribeLoggingConfigurationRequest { } /** - *

Contains information about the logging configuration.

+ *

Contains information about the logging configuration for the workspace.

* @public */ export interface LoggingConfigurationMetadata { @@ -1829,7 +1913,8 @@ export interface DescribeRuleGroupsNamespaceRequest { */ export interface RuleGroupsNamespaceDescription { /** - *

The ARN of the rule groups namespace.

+ *

The ARN of the rule groups namespace. For example, + * arn:aws:aps:<region>:123456789012:rulegroupsnamespace/ws-example1-1234-abcd-5678-ef90abcd1234/rulesfile1.

* @public */ arn: string | undefined; diff --git a/clients/client-amp/src/protocols/Aws_restJson1.ts b/clients/client-amp/src/protocols/Aws_restJson1.ts index b6d96dae47dcd..108d1078f9cf9 100644 --- a/clients/client-amp/src/protocols/Aws_restJson1.ts +++ b/clients/client-amp/src/protocols/Aws_restJson1.ts @@ -101,6 +101,7 @@ import { UpdateLoggingConfigurationCommandInput, UpdateLoggingConfigurationCommandOutput, } from "../commands/UpdateLoggingConfigurationCommand"; +import { UpdateScraperCommandInput, UpdateScraperCommandOutput } from "../commands/UpdateScraperCommand"; import { UpdateWorkspaceAliasCommandInput, UpdateWorkspaceAliasCommandOutput, @@ -639,6 +640,32 @@ export const se_UpdateLoggingConfigurationCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1UpdateScraperCommand + */ +export const se_UpdateScraperCommand = async ( + input: UpdateScraperCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/scrapers/{scraperId}"); + b.p("scraperId", () => input.scraperId!, "{scraperId}", false); + let body: any; + body = JSON.stringify( + take(input, { + alias: [], + clientToken: [true, (_) => _ ?? generateIdempotencyToken()], + destination: (_) => _json(_), + scrapeConfiguration: (_) => se_ScrapeConfiguration(_, context), + }) + ); + b.m("PUT").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1UpdateWorkspaceAliasCommand */ @@ -1181,6 +1208,30 @@ export const de_UpdateLoggingConfigurationCommand = async ( return contents; }; +/** + * deserializeAws_restJson1UpdateScraperCommand + */ +export const de_UpdateScraperCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 202 && output.statusCode >= 300) { + return de_CommandError(output, context); + } + const contents: any = map({ + $metadata: deserializeMetadata(output), + }); + const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); + const doc = take(data, { + arn: __expectString, + scraperId: __expectString, + status: _json, + tags: _json, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1UpdateWorkspaceAliasCommand */ diff --git a/codegen/sdk-codegen/aws-models/amp.json b/codegen/sdk-codegen/aws-models/amp.json index 5abfddd587930..135afdbeda619 100644 --- a/codegen/sdk-codegen/aws-models/amp.json +++ b/codegen/sdk-codegen/aws-models/amp.json @@ -83,7 +83,7 @@ } }, "traits": { - "smithy.api#documentation": "

The details of an alert manager definition.

" + "smithy.api#documentation": "

The details of an alert manager definition. It is the configuration for the\n alert manager, including information about receivers for routing alerts.

" } }, "com.amazonaws.amp#AlertManagerDefinitionStatus": { @@ -1140,7 +1140,7 @@ "logGroupArn": { "target": "com.amazonaws.amp#LogGroupArn", "traits": { - "smithy.api#documentation": "

The ARN of the CloudWatch log group to which the vended log data will be\n published. This log group must exist prior to calling this API.

", + "smithy.api#documentation": "

The ARN of the CloudWatch log group to which the vended log data will be\n published. This log group must exist prior to calling this operation.

", "smithy.api#required": {} } }, @@ -1322,7 +1322,7 @@ } ], "traits": { - "smithy.api#documentation": "

The CreateScraper operation creates a scraper to collect metrics. A\n scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS\n cluster, and sends them to your Amazon Managed Service for Prometheus workspace. You can configure the\n scraper to control what metrics are collected, and what transformations are applied\n prior to sending them to your workspace.

\n

If needed, an IAM role will be created for you that gives Amazon Managed Service for Prometheus access to the metrics in your cluster. For more information, see \n Using roles for scraping metrics from EKS in the Amazon Managed Service for Prometheus User \n Guide.

\n

You cannot update a scraper. If you want to change the configuration of the scraper,\n create a new scraper and delete the old one.

\n

The scrapeConfiguration parameter contains the base64-encoded version of\n the YAML configuration file.

\n \n

For more information about collectors, including what metrics are collected, and\n how to configure the scraper, see Amazon Web Services managed\n collectors in the Amazon Managed Service for Prometheus User \n Guide.

\n
", + "smithy.api#documentation": "

The CreateScraper operation creates a scraper to collect metrics. A\n scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS\n cluster, and sends them to your Amazon Managed Service for Prometheus workspace. Scrapers are \n flexible, and can be configured to control what metrics are collected, the \n frequency of collection, what transformations are applied to the metrics, and more.

\n

An IAM role will be created for you that Amazon Managed Service for Prometheus uses \n to access the metrics in your cluster. You must configure this role with a policy that\n allows it to scrape metrics from your cluster. For more information, see \n Configuring your Amazon EKS cluster in the Amazon Managed Service for Prometheus User Guide.

\n

The scrapeConfiguration parameter contains the base-64 encoded YAML \n configuration for the scraper.

\n \n

For more information about collectors, including what metrics are collected, and\n how to configure the scraper, see Using an \n Amazon Web Services managed\n collector in the Amazon Managed Service for Prometheus User \n Guide.

\n
", "smithy.api#examples": [ { "title": "CreateScraper with optional alias input, optional clientToken input, and one set of tags", @@ -1374,13 +1374,13 @@ "alias": { "target": "com.amazonaws.amp#ScraperAlias", "traits": { - "smithy.api#documentation": "

(optional) a name to associate with the scraper. This is for your use, and does not\n need to be unique.

" + "smithy.api#documentation": "

(optional) An alias to associate with the scraper. This is for your use, and does not\n need to be unique.

" } }, "scrapeConfiguration": { "target": "com.amazonaws.amp#ScrapeConfiguration", "traits": { - "smithy.api#documentation": "

The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User \n Guide.

", + "smithy.api#documentation": "

The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User \n Guide.

", "smithy.api#required": {} } }, @@ -2407,7 +2407,7 @@ "ampConfiguration": { "target": "com.amazonaws.amp#AmpConfiguration", "traits": { - "smithy.api#documentation": "

The Amazon Managed Service for Prometheusworkspace to send metrics to.

" + "smithy.api#documentation": "

The Amazon Managed Service for Prometheus workspace to send metrics to.

" } } }, @@ -2925,7 +2925,7 @@ } ], "traits": { - "smithy.api#documentation": "

The ListTagsForResource operation returns the tags that are associated\n with an Amazon Managed Service for Prometheus resource. Currently, the only resources that can be\n tagged are workspaces and rule groups namespaces.

", + "smithy.api#documentation": "

The ListTagsForResource operation returns the tags that are associated\n with an Amazon Managed Service for Prometheus resource. Currently, the only resources that can be\n tagged are scrapers, workspaces, and rule groups namespaces.

", "smithy.api#http": { "method": "GET", "uri": "/tags/{resourceArn}" @@ -2939,7 +2939,7 @@ "resourceArn": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

The ARN of the resource to list tages for. Must be a workspace or rule groups\n namespace resource.

", + "smithy.api#documentation": "

The ARN of the resource to list tages for. Must be a workspace, scraper, or rule groups\n namespace resource.

", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -3124,7 +3124,7 @@ } }, "traits": { - "smithy.api#documentation": "

Contains information about the logging configuration.

" + "smithy.api#documentation": "

Contains information about the logging configuration for the workspace.

" } }, "com.amazonaws.amp#LoggingConfigurationStatus": { @@ -3455,7 +3455,7 @@ "aws.api#arn": { "template": "rulegroupsnamespace/{workspaceId}/{name}" }, - "smithy.api#documentation": "

The definition of a rule group namespace in an Amazon Managed Service for Prometheus workspace.

" + "smithy.api#documentation": "

The definition of a rule groups namespace in an Amazon Managed Service for Prometheus workspace. \n A rule groups namespace is associated with exactly one rules file. A\n workspace can have multiple rule groups namespaces. For more information about\n rules files, see Creating a rules \n file, in the Amazon Managed Service for Prometheus User Guide.

" } }, "com.amazonaws.amp#RuleGroupsNamespaceArn": { @@ -3481,7 +3481,7 @@ "arn": { "target": "com.amazonaws.amp#RuleGroupsNamespaceArn", "traits": { - "smithy.api#documentation": "

The ARN of the rule groups namespace.

", + "smithy.api#documentation": "

The ARN of the rule groups namespace. For example, \n arn:aws:aps:<region>:123456789012:rulegroupsnamespace/ws-example1-1234-abcd-5678-ef90abcd1234/rulesfile1.

", "smithy.api#required": {} } }, @@ -3670,7 +3670,7 @@ } }, "traits": { - "smithy.api#documentation": "

A scrape configuration for a scraper, base 64 encoded. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User \n Guide.

" + "smithy.api#documentation": "

A scrape configuration for a scraper, base 64 encoded. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User \n Guide.

" } }, "com.amazonaws.amp#Scraper": { @@ -3686,6 +3686,9 @@ "read": { "target": "com.amazonaws.amp#DescribeScraper" }, + "update": { + "target": "com.amazonaws.amp#UpdateScraper" + }, "delete": { "target": "com.amazonaws.amp#DeleteScraper" }, @@ -3696,13 +3699,13 @@ "aws.api#arn": { "template": "scraper/{scraperId}" }, - "smithy.api#documentation": "

A scraper is a logical and isolated Prometheus server dedicated to discovering and \n collecting metrics and producing them to an Amazon Managed Service for Prometheus workspace.

" + "smithy.api#documentation": "

A scraper is a fully-managed agentless collector that discovers and \n pulls metrics automatically. A\n scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS\n cluster, and sends them to your Amazon Managed Service for Prometheus workspace. Scrapers are \n flexible. You can configure the scraper to control what metrics are collected, the \n frequency of collection, what transformations are applied to the metrics, and more.

\n

An IAM role will be created for you that Amazon Managed Service for Prometheus uses \n to access the metrics in your cluster. You must configure this role with a policy that\n allows it to scrape metrics from your cluster. For more information, see \n Configuring your Amazon EKS cluster in the Amazon Managed Service for Prometheus User Guide.

\n

The scrapeConfiguration parameter contains the YAML configuration for the \n scraper.

\n \n

For more information about collectors, including what metrics are collected, and\n how to configure the scraper, see Using an \n Amazon Web Services managed\n collector in the Amazon Managed Service for Prometheus User \n Guide.

\n
" } }, "com.amazonaws.amp#ScraperAlias": { "type": "string", "traits": { - "smithy.api#documentation": "

A user-assigned scraper alias.

", + "smithy.api#documentation": "

An optional user-assigned scraper alias.

", "smithy.api#length": { "min": 1, "max": 100 @@ -3733,21 +3736,21 @@ "scraperId": { "target": "com.amazonaws.amp#ScraperId", "traits": { - "smithy.api#documentation": "

The ID of the scraper.

", + "smithy.api#documentation": "

The ID of the scraper. For example, s-example1-1234-abcd-5678-ef9012abcd34.

", "smithy.api#required": {} } }, "arn": { "target": "com.amazonaws.amp#ScraperArn", "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the scraper.

", + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the scraper. For example, \n arn:aws:aps:<region>:123456798012:scraper/s-example1-1234-abcd-5678-ef9012abcd34.

", "smithy.api#required": {} } }, "roleArn": { "target": "com.amazonaws.amp#IamRoleArn", "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the IAM role that provides \n permissions for the scraper to discover and collect metrics on your behalf.

", + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the IAM role that provides \n permissions for the scraper to discover and collect metrics on your behalf.

\n

For example, arn:aws:iam::123456789012:role/service-role/AmazonGrafanaServiceRole-12example.

", "smithy.api#required": {} } }, @@ -3787,7 +3790,7 @@ "scrapeConfiguration": { "target": "com.amazonaws.amp#ScrapeConfiguration", "traits": { - "smithy.api#documentation": "

The configuration file in use by the scraper.

", + "smithy.api#documentation": "

The configuration in use by the scraper.

", "smithy.api#required": {} } }, @@ -3873,6 +3876,11 @@ "value": "CREATING", "documentation": "Scraper is being created. Deletion is disallowed until status is ACTIVE." }, + { + "name": "UPDATING", + "value": "UPDATING", + "documentation": "Scraper is being updated. Deletion is disallowed until status is ACTIVE." + }, { "name": "ACTIVE", "value": "ACTIVE", @@ -3888,6 +3896,11 @@ "value": "CREATION_FAILED", "documentation": "Scraper creation failed." }, + { + "name": "UPDATE_FAILED", + "value": "UPDATE_FAILED", + "documentation": "Scraper update failed." + }, { "name": "DELETION_FAILED", "value": "DELETION_FAILED", @@ -4130,7 +4143,7 @@ "key": { "target": "com.amazonaws.amp#TagKey", "traits": { - "smithy.api#documentation": "

The key of the tag. May not begin with aws:.

" + "smithy.api#documentation": "

The key of the tag. Must not begin with aws:.

" } }, "value": { @@ -4140,7 +4153,7 @@ } }, "traits": { - "smithy.api#documentation": "

The list of tags assigned to the resource.

", + "smithy.api#documentation": "

A tag associated with a resource.

", "smithy.api#length": { "max": 50 } @@ -4172,7 +4185,7 @@ } ], "traits": { - "smithy.api#documentation": "

The TagResource operation associates tags with an Amazon Managed Service for Prometheus\n resource. The only resources that can be tagged are workspaces and rule groups\n namespaces.

\n

If you specify a new tag key for the resource, this tag is appended to the list of\n tags associated with the resource. If you specify a tag key that is already associated\n with the resource, the new tag value that you specify replaces the previous value for\n that tag.

", + "smithy.api#documentation": "

The TagResource operation associates tags with an Amazon Managed Service for Prometheus\n resource. The only resources that can be tagged are rule groups namespaces, scrapers, \n and workspaces.

\n

If you specify a new tag key for the resource, this tag is appended to the list of\n tags associated with the resource. If you specify a tag key that is already associated\n with the resource, the new tag value that you specify replaces the previous value for\n that tag. To remove a tag, use UntagResource.

", "smithy.api#http": { "method": "POST", "uri": "/tags/{resourceArn}" @@ -4185,7 +4198,7 @@ "resourceArn": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

The ARN of the workspace or rule groups namespace to apply tags to.

", + "smithy.api#documentation": "

The ARN of the resource to apply tags to.

", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -4193,7 +4206,7 @@ "tags": { "target": "com.amazonaws.amp#TagMap", "traits": { - "smithy.api#documentation": "

The list of tag keys and values to associate with the resource.

\n

Keys may not begin with aws:.

", + "smithy.api#documentation": "

The list of tag keys and values to associate with the resource.

\n

Keys must not begin with aws:.

", "smithy.api#required": {} } } @@ -4276,7 +4289,7 @@ } ], "traits": { - "smithy.api#documentation": "

Removes the specified tags from an Amazon Managed Service for Prometheus resource. The only resources\n that can be tagged are workspaces and rule groups namespaces.

", + "smithy.api#documentation": "

Removes the specified tags from an Amazon Managed Service for Prometheus resource. The only resources\n that can be tagged are rule groups namespaces, scrapers, and workspaces.

", "smithy.api#http": { "method": "DELETE", "uri": "/tags/{resourceArn}" @@ -4290,7 +4303,7 @@ "resourceArn": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

The ARN of the workspace or rule groups namespace.

", + "smithy.api#documentation": "

The ARN of the resource from which to remove a tag.

", "smithy.api#httpLabel": {}, "smithy.api#required": {} } @@ -4389,6 +4402,151 @@ "smithy.api#documentation": "

Represents the output of an UpdateLoggingConfiguration operation.

" } }, + "com.amazonaws.amp#UpdateScraper": { + "type": "operation", + "input": { + "target": "com.amazonaws.amp#UpdateScraperRequest" + }, + "output": { + "target": "com.amazonaws.amp#UpdateScraperResponse" + }, + "errors": [ + { + "target": "com.amazonaws.amp#AccessDeniedException" + }, + { + "target": "com.amazonaws.amp#ConflictException" + }, + { + "target": "com.amazonaws.amp#InternalServerException" + }, + { + "target": "com.amazonaws.amp#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.amp#ServiceQuotaExceededException" + }, + { + "target": "com.amazonaws.amp#ThrottlingException" + }, + { + "target": "com.amazonaws.amp#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Updates an existing scraper.

\n

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

", + "smithy.api#examples": [ + { + "title": "UpdateScraper with all optional parameters", + "input": { + "scraperId": "scraper-123", + "alias": "alias-update", + "scrapeConfiguration": { + "configurationBlob": "blob-update" + }, + "destination": { + "ampConfiguration": { + "workspaceArn": "arn:aws:aps:us-west-2:123456789012:workspace/ws-ogh2u499-ce12-hg89-v6c7-123412341234-update" + } + }, + "clientToken": "token" + }, + "output": { + "scraperId": "scraper-123", + "arn": "arn:aws:aps:us-west-2:123456789012:scraper/scraper-123", + "status": { + "statusCode": "UPDATING" + }, + "tags": { + "exampleTag": "exampleValue" + } + } + } + ], + "smithy.api#http": { + "code": 202, + "method": "PUT", + "uri": "/scrapers/{scraperId}" + }, + "smithy.api#idempotent": {} + } + }, + "com.amazonaws.amp#UpdateScraperRequest": { + "type": "structure", + "members": { + "scraperId": { + "target": "com.amazonaws.amp#ScraperId", + "traits": { + "smithy.api#documentation": "

The ID of the scraper to update.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "alias": { + "target": "com.amazonaws.amp#ScraperAlias", + "traits": { + "smithy.api#documentation": "

The new alias of the scraper.

" + } + }, + "scrapeConfiguration": { + "target": "com.amazonaws.amp#ScrapeConfiguration", + "traits": { + "smithy.api#documentation": "

Contains the base-64 encoded YAML configuration for the scraper.

\n \n

For more information about configuring a scraper, see Using an \n Amazon Web Services managed collector in the Amazon Managed Service for Prometheus \n User Guide.

\n
" + } + }, + "destination": { + "target": "com.amazonaws.amp#Destination", + "traits": { + "smithy.api#documentation": "

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

" + } + }, + "clientToken": { + "target": "com.amazonaws.amp#IdempotencyToken", + "traits": { + "smithy.api#documentation": "

A unique identifier that you can provide to ensure the idempotency of the request.\n Case-sensitive.

", + "smithy.api#idempotencyToken": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.amp#UpdateScraperResponse": { + "type": "structure", + "members": { + "scraperId": { + "target": "com.amazonaws.amp#ScraperId", + "traits": { + "smithy.api#documentation": "

The ID of the updated scraper.

", + "smithy.api#required": {} + } + }, + "arn": { + "target": "com.amazonaws.amp#ScraperArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the updated scraper.

", + "smithy.api#required": {} + } + }, + "status": { + "target": "com.amazonaws.amp#ScraperStatus", + "traits": { + "smithy.api#documentation": "

A structure that displays the current status of the scraper.

", + "smithy.api#required": {} + } + }, + "tags": { + "target": "com.amazonaws.amp#TagMap", + "traits": { + "smithy.api#documentation": "

The list of tag keys and values that are associated with the scraper.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.amp#UpdateWorkspaceAlias": { "type": "operation", "input": { @@ -4621,20 +4779,20 @@ "workspaceId": { "target": "com.amazonaws.amp#WorkspaceId", "traits": { - "smithy.api#documentation": "

The unique ID for the workspace.

", + "smithy.api#documentation": "

The unique ID for the workspace. For example, \n ws-example1-1234-abcd-5678-ef90abcd1234.

", "smithy.api#required": {} } }, "alias": { "target": "com.amazonaws.amp#WorkspaceAlias", "traits": { - "smithy.api#documentation": "

The alias that is assigned to this workspace to help identify it. It may not be\n unique.

" + "smithy.api#documentation": "

The alias that is assigned to this workspace to help identify it. It does not need\n to be unique.

" } }, "arn": { "target": "com.amazonaws.amp#WorkspaceArn", "traits": { - "smithy.api#documentation": "

The ARN of the workspace.

", + "smithy.api#documentation": "

The ARN of the workspace. For example, \n arn:aws:aps:<region>:123456789012:workspace/ws-example1-1234-abcd-5678-ef90abcd1234.

", "smithy.api#required": {} } }, @@ -4648,7 +4806,7 @@ "prometheusEndpoint": { "target": "com.amazonaws.amp#Uri", "traits": { - "smithy.api#documentation": "

The Prometheus endpoint available for this workspace.

" + "smithy.api#documentation": "

The Prometheus endpoint available for this workspace. For example,\n https://aps-workspaces.<region>.amazonaws.com/workspaces/ws-example1-1234-abcd-5678-ef90abcd1234/api/v1/.

" } }, "createdAt": { @@ -4752,7 +4910,7 @@ "alias": { "target": "com.amazonaws.amp#WorkspaceAlias", "traits": { - "smithy.api#documentation": "

The alias that is assigned to this workspace to help identify it. It may not be\n unique.

" + "smithy.api#documentation": "

The alias that is assigned to this workspace to help identify it. It does not \n need to be unique.

" } }, "arn": {