Skip to content

Commit

Permalink
feat(client-amp): Added support for UpdateScraper API, to enable upda…
Browse files Browse the repository at this point in the history
…ting collector configuration in-place
  • Loading branch information
awstools committed Oct 31, 2024
1 parent 410614c commit 87ff3b9
Show file tree
Hide file tree
Showing 12 changed files with 527 additions and 70 deletions.
10 changes: 9 additions & 1 deletion clients/client-amp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ workspace.</p>

## 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`
Expand Down Expand Up @@ -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/)

</details>
<details>
<summary>
UpdateScraper
</summary>

[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/)

</details>
<details>
<summary>
Expand Down
17 changes: 17 additions & 0 deletions clients/client-amp/src/Amp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ import {
UpdateLoggingConfigurationCommandInput,
UpdateLoggingConfigurationCommandOutput,
} from "./commands/UpdateLoggingConfigurationCommand";
import {
UpdateScraperCommand,
UpdateScraperCommandInput,
UpdateScraperCommandOutput,
} from "./commands/UpdateScraperCommand";
import {
UpdateWorkspaceAliasCommand,
UpdateWorkspaceAliasCommandInput,
Expand Down Expand Up @@ -156,6 +161,7 @@ const commands = {
TagResourceCommand,
UntagResourceCommand,
UpdateLoggingConfigurationCommand,
UpdateScraperCommand,
UpdateWorkspaceAliasCommand,
};

Expand Down Expand Up @@ -547,6 +553,17 @@ export interface Amp {
cb: (err: any, data?: UpdateLoggingConfigurationCommandOutput) => void
): void;

/**
* @see {@link UpdateScraperCommand}
*/
updateScraper(args: UpdateScraperCommandInput, options?: __HttpHandlerOptions): Promise<UpdateScraperCommandOutput>;
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}
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-amp/src/AmpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ import {
UpdateLoggingConfigurationCommandInput,
UpdateLoggingConfigurationCommandOutput,
} from "./commands/UpdateLoggingConfigurationCommand";
import { UpdateScraperCommandInput, UpdateScraperCommandOutput } from "./commands/UpdateScraperCommand";
import {
UpdateWorkspaceAliasCommandInput,
UpdateWorkspaceAliasCommandOutput,
Expand Down Expand Up @@ -167,6 +168,7 @@ export type ServiceInputTypes =
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateLoggingConfigurationCommandInput
| UpdateScraperCommandInput
| UpdateWorkspaceAliasCommandInput;

/**
Expand Down Expand Up @@ -198,6 +200,7 @@ export type ServiceOutputTypes =
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateLoggingConfigurationCommandOutput
| UpdateScraperCommandOutput
| UpdateWorkspaceAliasCommandOutput;

/**
Expand Down
24 changes: 12 additions & 12 deletions clients/client-amp/src/commands/CreateScraperCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ export interface CreateScraperCommandOutput extends CreateScraperResponse, __Met
/**
* <p>The <code>CreateScraper</code> 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.</p>
* <p>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
* <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/using-service-linked-roles.html#using-service-linked-roles-prom-scraper">Using roles for scraping metrics from EKS</a> in the <i>Amazon Managed Service for Prometheus User
* Guide</i>.</p>
* <p>You cannot update a scraper. If you want to change the configuration of the scraper,
* create a new scraper and delete the old one.</p>
* <p>The <code>scrapeConfiguration</code> parameter contains the base64-encoded version of
* the YAML configuration file.</p>
* 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.</p>
* <p>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
* <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html#AMP-collector-eks-setup">Configuring your Amazon EKS cluster</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>
* <p>The <code>scrapeConfiguration</code> parameter contains the base-64 encoded YAML
* configuration for the scraper.</p>
* <note>
* <p>For more information about collectors, including what metrics are collected, and
* how to configure the scraper, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector.html">Amazon Web Services managed
* collectors</a> in the <i>Amazon Managed Service for Prometheus User
* how to configure the scraper, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-collector-how-to.html">Using an
* Amazon Web Services managed
* collector</a> in the <i>Amazon Managed Service for Prometheus User
* Guide</i>.</p>
* </note>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface ListTagsForResourceCommandOutput extends ListTagsForResourceRes
/**
* <p>The <code>ListTagsForResource</code> 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. </p>
* tagged are scrapers, workspaces, and rule groups namespaces. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
6 changes: 3 additions & 3 deletions clients/client-amp/src/commands/TagResourceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export interface TagResourceCommandOutput extends TagResourceResponse, __Metadat

/**
* <p>The <code>TagResource</code> operation associates tags with an Amazon Managed Service for Prometheus
* resource. The only resources that can be tagged are workspaces and rule groups
* namespaces. </p>
* resource. The only resources that can be tagged are rule groups namespaces, scrapers,
* and workspaces.</p>
* <p>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.</p>
* that tag. To remove a tag, use <code>UntagResource</code>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
2 changes: 1 addition & 1 deletion clients/client-amp/src/commands/UntagResourceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface UntagResourceCommandOutput extends UntagResourceResponse, __Met

/**
* <p>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. </p>
* that can be tagged are rule groups namespaces, scrapers, and workspaces. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
134 changes: 134 additions & 0 deletions clients/client-amp/src/commands/UpdateScraperCommand.ts
Original file line number Diff line number Diff line change
@@ -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 {}

/**
* <p>Updates an existing scraper.</p>
* <p>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.</p>
* @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
* // "<keys>": "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)
* <p>You do not have sufficient access to perform this action.</p>
*
* @throws {@link ConflictException} (client fault)
* <p>The request would cause an inconsistent state.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An unexpected error occurred during the processing of the request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The request references a resources that doesn't exist.</p>
*
* @throws {@link ServiceQuotaExceededException} (client fault)
* <p>Completing the request would cause a service quota to be exceeded.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied due to request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input fails to satisfy the constraints specified by an Amazon Web Services
* service.</p>
*
* @throws {@link AmpServiceException}
* <p>Base exception class for all service exceptions from Amp service.</p>
*
* @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;
};
};
}
1 change: 1 addition & 0 deletions clients/client-amp/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export * from "./PutRuleGroupsNamespaceCommand";
export * from "./TagResourceCommand";
export * from "./UntagResourceCommand";
export * from "./UpdateLoggingConfigurationCommand";
export * from "./UpdateScraperCommand";
export * from "./UpdateWorkspaceAliasCommand";
Loading

0 comments on commit 87ff3b9

Please sign in to comment.