From 6c98871766ef0670a974ce73fbcdeefd0a51a43d Mon Sep 17 00:00:00 2001 From: awstools Date: Wed, 15 May 2024 18:11:49 +0000 Subject: [PATCH] feat(client-grafana): This release adds new ServiceAccount and ServiceAccountToken APIs. --- clients/client-grafana/README.md | 48 + clients/client-grafana/src/Grafana.ts | 138 +++ clients/client-grafana/src/GrafanaClient.ts | 36 + .../src/commands/AssociateLicenseCommand.ts | 4 +- .../commands/CreateWorkspaceApiKeyCommand.ts | 4 + .../CreateWorkspaceServiceAccountCommand.ts | 124 +++ ...eateWorkspaceServiceAccountTokenCommand.ts | 132 +++ .../commands/DeleteWorkspaceApiKeyCommand.ts | 4 + .../DeleteWorkspaceServiceAccountCommand.ts | 111 +++ ...leteWorkspaceServiceAccountTokenCommand.ts | 116 +++ .../DescribeWorkspaceAuthenticationCommand.ts | 3 + ...istWorkspaceServiceAccountTokensCommand.ts | 127 +++ .../ListWorkspaceServiceAccountsCommand.ts | 117 +++ clients/client-grafana/src/commands/index.ts | 6 + clients/client-grafana/src/models/models_0.ts | 424 ++++++++- ...tWorkspaceServiceAccountTokensPaginator.ts | 24 + .../ListWorkspaceServiceAccountsPaginator.ts | 24 + .../client-grafana/src/pagination/index.ts | 2 + .../src/protocols/Aws_restJson1.ts | 320 +++++++ codegen/sdk-codegen/aws-models/grafana.json | 894 +++++++++++++++++- 20 files changed, 2621 insertions(+), 37 deletions(-) create mode 100644 clients/client-grafana/src/commands/CreateWorkspaceServiceAccountCommand.ts create mode 100644 clients/client-grafana/src/commands/CreateWorkspaceServiceAccountTokenCommand.ts create mode 100644 clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountCommand.ts create mode 100644 clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountTokenCommand.ts create mode 100644 clients/client-grafana/src/commands/ListWorkspaceServiceAccountTokensCommand.ts create mode 100644 clients/client-grafana/src/commands/ListWorkspaceServiceAccountsCommand.ts create mode 100644 clients/client-grafana/src/pagination/ListWorkspaceServiceAccountTokensPaginator.ts create mode 100644 clients/client-grafana/src/pagination/ListWorkspaceServiceAccountsPaginator.ts diff --git a/clients/client-grafana/README.md b/clients/client-grafana/README.md index 323b25203b3f..384c51a37543 100644 --- a/clients/client-grafana/README.md +++ b/clients/client-grafana/README.md @@ -234,6 +234,22 @@ CreateWorkspaceApiKey [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/CreateWorkspaceApiKeyCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceApiKeyCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceApiKeyCommandOutput/) + +
+ +CreateWorkspaceServiceAccount + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/CreateWorkspaceServiceAccountCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceServiceAccountCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceServiceAccountCommandOutput/) + +
+
+ +CreateWorkspaceServiceAccountToken + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/CreateWorkspaceServiceAccountTokenCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceServiceAccountTokenCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/CreateWorkspaceServiceAccountTokenCommandOutput/) +
@@ -250,6 +266,22 @@ DeleteWorkspaceApiKey [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/DeleteWorkspaceApiKeyCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceApiKeyCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceApiKeyCommandOutput/) +
+
+ +DeleteWorkspaceServiceAccount + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/DeleteWorkspaceServiceAccountCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceServiceAccountCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceServiceAccountCommandOutput/) + +
+
+ +DeleteWorkspaceServiceAccountToken + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/DeleteWorkspaceServiceAccountTokenCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceServiceAccountTokenCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/DeleteWorkspaceServiceAccountTokenCommandOutput/) +
@@ -314,6 +346,22 @@ ListWorkspaces [Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/ListWorkspacesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspacesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspacesCommandOutput/) +
+
+ +ListWorkspaceServiceAccounts + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/ListWorkspaceServiceAccountsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspaceServiceAccountsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspaceServiceAccountsCommandOutput/) + +
+
+ +ListWorkspaceServiceAccountTokens + + +[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/grafana/command/ListWorkspaceServiceAccountTokensCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspaceServiceAccountTokensCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-grafana/Interface/ListWorkspaceServiceAccountTokensCommandOutput/) +
diff --git a/clients/client-grafana/src/Grafana.ts b/clients/client-grafana/src/Grafana.ts index bfaafa18a5d7..a1925f688636 100644 --- a/clients/client-grafana/src/Grafana.ts +++ b/clients/client-grafana/src/Grafana.ts @@ -17,6 +17,16 @@ import { CreateWorkspaceCommandInput, CreateWorkspaceCommandOutput, } from "./commands/CreateWorkspaceCommand"; +import { + CreateWorkspaceServiceAccountCommand, + CreateWorkspaceServiceAccountCommandInput, + CreateWorkspaceServiceAccountCommandOutput, +} from "./commands/CreateWorkspaceServiceAccountCommand"; +import { + CreateWorkspaceServiceAccountTokenCommand, + CreateWorkspaceServiceAccountTokenCommandInput, + CreateWorkspaceServiceAccountTokenCommandOutput, +} from "./commands/CreateWorkspaceServiceAccountTokenCommand"; import { DeleteWorkspaceApiKeyCommand, DeleteWorkspaceApiKeyCommandInput, @@ -27,6 +37,16 @@ import { DeleteWorkspaceCommandInput, DeleteWorkspaceCommandOutput, } from "./commands/DeleteWorkspaceCommand"; +import { + DeleteWorkspaceServiceAccountCommand, + DeleteWorkspaceServiceAccountCommandInput, + DeleteWorkspaceServiceAccountCommandOutput, +} from "./commands/DeleteWorkspaceServiceAccountCommand"; +import { + DeleteWorkspaceServiceAccountTokenCommand, + DeleteWorkspaceServiceAccountTokenCommandInput, + DeleteWorkspaceServiceAccountTokenCommandOutput, +} from "./commands/DeleteWorkspaceServiceAccountTokenCommand"; import { DescribeWorkspaceAuthenticationCommand, DescribeWorkspaceAuthenticationCommandInput, @@ -67,6 +87,16 @@ import { ListWorkspacesCommandInput, ListWorkspacesCommandOutput, } from "./commands/ListWorkspacesCommand"; +import { + ListWorkspaceServiceAccountsCommand, + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput, +} from "./commands/ListWorkspaceServiceAccountsCommand"; +import { + ListWorkspaceServiceAccountTokensCommand, + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput, +} from "./commands/ListWorkspaceServiceAccountTokensCommand"; import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommand, @@ -99,8 +129,12 @@ const commands = { AssociateLicenseCommand, CreateWorkspaceCommand, CreateWorkspaceApiKeyCommand, + CreateWorkspaceServiceAccountCommand, + CreateWorkspaceServiceAccountTokenCommand, DeleteWorkspaceCommand, DeleteWorkspaceApiKeyCommand, + DeleteWorkspaceServiceAccountCommand, + DeleteWorkspaceServiceAccountTokenCommand, DescribeWorkspaceCommand, DescribeWorkspaceAuthenticationCommand, DescribeWorkspaceConfigurationCommand, @@ -109,6 +143,8 @@ const commands = { ListTagsForResourceCommand, ListVersionsCommand, ListWorkspacesCommand, + ListWorkspaceServiceAccountsCommand, + ListWorkspaceServiceAccountTokensCommand, TagResourceCommand, UntagResourceCommand, UpdatePermissionsCommand, @@ -166,6 +202,40 @@ export interface Grafana { cb: (err: any, data?: CreateWorkspaceApiKeyCommandOutput) => void ): void; + /** + * @see {@link CreateWorkspaceServiceAccountCommand} + */ + createWorkspaceServiceAccount( + args: CreateWorkspaceServiceAccountCommandInput, + options?: __HttpHandlerOptions + ): Promise; + createWorkspaceServiceAccount( + args: CreateWorkspaceServiceAccountCommandInput, + cb: (err: any, data?: CreateWorkspaceServiceAccountCommandOutput) => void + ): void; + createWorkspaceServiceAccount( + args: CreateWorkspaceServiceAccountCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: CreateWorkspaceServiceAccountCommandOutput) => void + ): void; + + /** + * @see {@link CreateWorkspaceServiceAccountTokenCommand} + */ + createWorkspaceServiceAccountToken( + args: CreateWorkspaceServiceAccountTokenCommandInput, + options?: __HttpHandlerOptions + ): Promise; + createWorkspaceServiceAccountToken( + args: CreateWorkspaceServiceAccountTokenCommandInput, + cb: (err: any, data?: CreateWorkspaceServiceAccountTokenCommandOutput) => void + ): void; + createWorkspaceServiceAccountToken( + args: CreateWorkspaceServiceAccountTokenCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: CreateWorkspaceServiceAccountTokenCommandOutput) => void + ): void; + /** * @see {@link DeleteWorkspaceCommand} */ @@ -197,6 +267,40 @@ export interface Grafana { cb: (err: any, data?: DeleteWorkspaceApiKeyCommandOutput) => void ): void; + /** + * @see {@link DeleteWorkspaceServiceAccountCommand} + */ + deleteWorkspaceServiceAccount( + args: DeleteWorkspaceServiceAccountCommandInput, + options?: __HttpHandlerOptions + ): Promise; + deleteWorkspaceServiceAccount( + args: DeleteWorkspaceServiceAccountCommandInput, + cb: (err: any, data?: DeleteWorkspaceServiceAccountCommandOutput) => void + ): void; + deleteWorkspaceServiceAccount( + args: DeleteWorkspaceServiceAccountCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DeleteWorkspaceServiceAccountCommandOutput) => void + ): void; + + /** + * @see {@link DeleteWorkspaceServiceAccountTokenCommand} + */ + deleteWorkspaceServiceAccountToken( + args: DeleteWorkspaceServiceAccountTokenCommandInput, + options?: __HttpHandlerOptions + ): Promise; + deleteWorkspaceServiceAccountToken( + args: DeleteWorkspaceServiceAccountTokenCommandInput, + cb: (err: any, data?: DeleteWorkspaceServiceAccountTokenCommandOutput) => void + ): void; + deleteWorkspaceServiceAccountToken( + args: DeleteWorkspaceServiceAccountTokenCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: DeleteWorkspaceServiceAccountTokenCommandOutput) => void + ): void; + /** * @see {@link DescribeWorkspaceCommand} */ @@ -323,6 +427,40 @@ export interface Grafana { cb: (err: any, data?: ListWorkspacesCommandOutput) => void ): void; + /** + * @see {@link ListWorkspaceServiceAccountsCommand} + */ + listWorkspaceServiceAccounts( + args: ListWorkspaceServiceAccountsCommandInput, + options?: __HttpHandlerOptions + ): Promise; + listWorkspaceServiceAccounts( + args: ListWorkspaceServiceAccountsCommandInput, + cb: (err: any, data?: ListWorkspaceServiceAccountsCommandOutput) => void + ): void; + listWorkspaceServiceAccounts( + args: ListWorkspaceServiceAccountsCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ListWorkspaceServiceAccountsCommandOutput) => void + ): void; + + /** + * @see {@link ListWorkspaceServiceAccountTokensCommand} + */ + listWorkspaceServiceAccountTokens( + args: ListWorkspaceServiceAccountTokensCommandInput, + options?: __HttpHandlerOptions + ): Promise; + listWorkspaceServiceAccountTokens( + args: ListWorkspaceServiceAccountTokensCommandInput, + cb: (err: any, data?: ListWorkspaceServiceAccountTokensCommandOutput) => void + ): void; + listWorkspaceServiceAccountTokens( + args: ListWorkspaceServiceAccountTokensCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: ListWorkspaceServiceAccountTokensCommandOutput) => void + ): void; + /** * @see {@link TagResourceCommand} */ diff --git a/clients/client-grafana/src/GrafanaClient.ts b/clients/client-grafana/src/GrafanaClient.ts index 622b5109dc2c..80628edbf523 100644 --- a/clients/client-grafana/src/GrafanaClient.ts +++ b/clients/client-grafana/src/GrafanaClient.ts @@ -59,11 +59,27 @@ import { CreateWorkspaceApiKeyCommandOutput, } from "./commands/CreateWorkspaceApiKeyCommand"; import { CreateWorkspaceCommandInput, CreateWorkspaceCommandOutput } from "./commands/CreateWorkspaceCommand"; +import { + CreateWorkspaceServiceAccountCommandInput, + CreateWorkspaceServiceAccountCommandOutput, +} from "./commands/CreateWorkspaceServiceAccountCommand"; +import { + CreateWorkspaceServiceAccountTokenCommandInput, + CreateWorkspaceServiceAccountTokenCommandOutput, +} from "./commands/CreateWorkspaceServiceAccountTokenCommand"; import { DeleteWorkspaceApiKeyCommandInput, DeleteWorkspaceApiKeyCommandOutput, } from "./commands/DeleteWorkspaceApiKeyCommand"; import { DeleteWorkspaceCommandInput, DeleteWorkspaceCommandOutput } from "./commands/DeleteWorkspaceCommand"; +import { + DeleteWorkspaceServiceAccountCommandInput, + DeleteWorkspaceServiceAccountCommandOutput, +} from "./commands/DeleteWorkspaceServiceAccountCommand"; +import { + DeleteWorkspaceServiceAccountTokenCommandInput, + DeleteWorkspaceServiceAccountTokenCommandOutput, +} from "./commands/DeleteWorkspaceServiceAccountTokenCommand"; import { DescribeWorkspaceAuthenticationCommandInput, DescribeWorkspaceAuthenticationCommandOutput, @@ -84,6 +100,14 @@ import { } from "./commands/ListTagsForResourceCommand"; import { ListVersionsCommandInput, ListVersionsCommandOutput } from "./commands/ListVersionsCommand"; import { ListWorkspacesCommandInput, ListWorkspacesCommandOutput } from "./commands/ListWorkspacesCommand"; +import { + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput, +} from "./commands/ListWorkspaceServiceAccountsCommand"; +import { + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput, +} from "./commands/ListWorkspaceServiceAccountTokensCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand"; import { UpdatePermissionsCommandInput, UpdatePermissionsCommandOutput } from "./commands/UpdatePermissionsCommand"; @@ -114,8 +138,12 @@ export type ServiceInputTypes = | AssociateLicenseCommandInput | CreateWorkspaceApiKeyCommandInput | CreateWorkspaceCommandInput + | CreateWorkspaceServiceAccountCommandInput + | CreateWorkspaceServiceAccountTokenCommandInput | DeleteWorkspaceApiKeyCommandInput | DeleteWorkspaceCommandInput + | DeleteWorkspaceServiceAccountCommandInput + | DeleteWorkspaceServiceAccountTokenCommandInput | DescribeWorkspaceAuthenticationCommandInput | DescribeWorkspaceCommandInput | DescribeWorkspaceConfigurationCommandInput @@ -123,6 +151,8 @@ export type ServiceInputTypes = | ListPermissionsCommandInput | ListTagsForResourceCommandInput | ListVersionsCommandInput + | ListWorkspaceServiceAccountTokensCommandInput + | ListWorkspaceServiceAccountsCommandInput | ListWorkspacesCommandInput | TagResourceCommandInput | UntagResourceCommandInput @@ -138,8 +168,12 @@ export type ServiceOutputTypes = | AssociateLicenseCommandOutput | CreateWorkspaceApiKeyCommandOutput | CreateWorkspaceCommandOutput + | CreateWorkspaceServiceAccountCommandOutput + | CreateWorkspaceServiceAccountTokenCommandOutput | DeleteWorkspaceApiKeyCommandOutput | DeleteWorkspaceCommandOutput + | DeleteWorkspaceServiceAccountCommandOutput + | DeleteWorkspaceServiceAccountTokenCommandOutput | DescribeWorkspaceAuthenticationCommandOutput | DescribeWorkspaceCommandOutput | DescribeWorkspaceConfigurationCommandOutput @@ -147,6 +181,8 @@ export type ServiceOutputTypes = | ListPermissionsCommandOutput | ListTagsForResourceCommandOutput | ListVersionsCommandOutput + | ListWorkspaceServiceAccountTokensCommandOutput + | ListWorkspaceServiceAccountsCommandOutput | ListWorkspacesCommandOutput | TagResourceCommandOutput | UntagResourceCommandOutput diff --git a/clients/client-grafana/src/commands/AssociateLicenseCommand.ts b/clients/client-grafana/src/commands/AssociateLicenseCommand.ts index 3af17ff1f4af..0c736925599a 100644 --- a/clients/client-grafana/src/commands/AssociateLicenseCommand.ts +++ b/clients/client-grafana/src/commands/AssociateLicenseCommand.ts @@ -31,7 +31,9 @@ export interface AssociateLicenseCommandInput extends AssociateLicenseRequest {} export interface AssociateLicenseCommandOutput extends AssociateLicenseResponse, __MetadataBearer {} /** - *

Assigns a Grafana Enterprise license to a workspace. Upgrading to Grafana Enterprise + *

Assigns a Grafana Enterprise license to a workspace. To upgrade, you must use + * ENTERPRISE for the licenseType, and pass in a valid + * Grafana Labs token for the grafanaToken. Upgrading to Grafana Enterprise * incurs additional fees. For more information, see Upgrade a * workspace to Grafana Enterprise.

* @example diff --git a/clients/client-grafana/src/commands/CreateWorkspaceApiKeyCommand.ts b/clients/client-grafana/src/commands/CreateWorkspaceApiKeyCommand.ts index d5275614b16e..328ed59afcaf 100644 --- a/clients/client-grafana/src/commands/CreateWorkspaceApiKeyCommand.ts +++ b/clients/client-grafana/src/commands/CreateWorkspaceApiKeyCommand.ts @@ -34,6 +34,10 @@ export interface CreateWorkspaceApiKeyCommandOutput extends CreateWorkspaceApiKe *

Creates a Grafana API key for the workspace. This key can be used to authenticate * requests sent to the workspace's HTTP API. See https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html * for available APIs and example requests.

+ * + *

In workspaces compatible with Grafana version 9 or above, use workspace service + * accounts instead of API keys. API keys will be removed in a future release.

+ *
* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountCommand.ts b/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountCommand.ts new file mode 100644 index 000000000000..d13054c78742 --- /dev/null +++ b/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountCommand.ts @@ -0,0 +1,124 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { CreateWorkspaceServiceAccountRequest, CreateWorkspaceServiceAccountResponse } from "../models/models_0"; +import { + de_CreateWorkspaceServiceAccountCommand, + se_CreateWorkspaceServiceAccountCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link CreateWorkspaceServiceAccountCommand}. + */ +export interface CreateWorkspaceServiceAccountCommandInput extends CreateWorkspaceServiceAccountRequest {} +/** + * @public + * + * The output of {@link CreateWorkspaceServiceAccountCommand}. + */ +export interface CreateWorkspaceServiceAccountCommandOutput + extends CreateWorkspaceServiceAccountResponse, + __MetadataBearer {} + +/** + *

Creates a service account for the workspace. A service account can be used to call + * Grafana HTTP APIs, and run automated workloads. After creating the service account with + * the correct GrafanaRole for your use case, use + * CreateWorkspaceServiceAccountToken to create a token that can be used to + * authenticate and authorize Grafana HTTP API calls.

+ *

You can only create service accounts for workspaces that are compatible with Grafana + * version 9 and above.

+ * + *

For more information about service accounts, see Service accounts in + * the Amazon Managed Grafana User Guide.

+ *

For more information about the Grafana HTTP APIs, see Using Grafana HTTP + * APIs in the Amazon Managed Grafana User Guide.

+ *
+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, CreateWorkspaceServiceAccountCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, CreateWorkspaceServiceAccountCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // CreateWorkspaceServiceAccountRequest + * name: "STRING_VALUE", // required + * grafanaRole: "STRING_VALUE", // required + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new CreateWorkspaceServiceAccountCommand(input); + * const response = await client.send(command); + * // { // CreateWorkspaceServiceAccountResponse + * // id: "STRING_VALUE", // required + * // name: "STRING_VALUE", // required + * // grafanaRole: "STRING_VALUE", // required + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param CreateWorkspaceServiceAccountCommandInput - {@link CreateWorkspaceServiceAccountCommandInput} + * @returns {@link CreateWorkspaceServiceAccountCommandOutput} + * @see {@link CreateWorkspaceServiceAccountCommandInput} for command's `input` shape. + * @see {@link CreateWorkspaceServiceAccountCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request would cause a service quota to be exceeded.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class CreateWorkspaceServiceAccountCommand extends $Command + .classBuilder< + CreateWorkspaceServiceAccountCommandInput, + CreateWorkspaceServiceAccountCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "CreateWorkspaceServiceAccount", {}) + .n("GrafanaClient", "CreateWorkspaceServiceAccountCommand") + .f(void 0, void 0) + .ser(se_CreateWorkspaceServiceAccountCommand) + .de(de_CreateWorkspaceServiceAccountCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountTokenCommand.ts b/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountTokenCommand.ts new file mode 100644 index 000000000000..0d23d1620150 --- /dev/null +++ b/clients/client-grafana/src/commands/CreateWorkspaceServiceAccountTokenCommand.ts @@ -0,0 +1,132 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { + CreateWorkspaceServiceAccountTokenRequest, + CreateWorkspaceServiceAccountTokenResponse, + CreateWorkspaceServiceAccountTokenResponseFilterSensitiveLog, +} from "../models/models_0"; +import { + de_CreateWorkspaceServiceAccountTokenCommand, + se_CreateWorkspaceServiceAccountTokenCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link CreateWorkspaceServiceAccountTokenCommand}. + */ +export interface CreateWorkspaceServiceAccountTokenCommandInput extends CreateWorkspaceServiceAccountTokenRequest {} +/** + * @public + * + * The output of {@link CreateWorkspaceServiceAccountTokenCommand}. + */ +export interface CreateWorkspaceServiceAccountTokenCommandOutput + extends CreateWorkspaceServiceAccountTokenResponse, + __MetadataBearer {} + +/** + *

Creates a token that can be used to authenticate and authorize Grafana HTTP API + * operations for the given workspace service + * account. The service account acts as a user for the API operations, and + * defines the permissions that are used by the API.

+ * + *

When you create the service account token, you will receive a key that is used + * when calling Grafana APIs. Do not lose this key, as it will not be retrievable + * again.

+ *

If you do lose the key, you can delete the token and recreate it to receive a + * new key. This will disable the initial key.

+ *
+ *

Service accounts are only available for workspaces that are compatible with Grafana + * version 9 and above.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, CreateWorkspaceServiceAccountTokenCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, CreateWorkspaceServiceAccountTokenCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // CreateWorkspaceServiceAccountTokenRequest + * name: "STRING_VALUE", // required + * secondsToLive: Number("int"), // required + * serviceAccountId: "STRING_VALUE", // required + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new CreateWorkspaceServiceAccountTokenCommand(input); + * const response = await client.send(command); + * // { // CreateWorkspaceServiceAccountTokenResponse + * // serviceAccountToken: { // ServiceAccountTokenSummaryWithKey + * // id: "STRING_VALUE", // required + * // name: "STRING_VALUE", // required + * // key: "STRING_VALUE", // required + * // }, + * // serviceAccountId: "STRING_VALUE", // required + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param CreateWorkspaceServiceAccountTokenCommandInput - {@link CreateWorkspaceServiceAccountTokenCommandInput} + * @returns {@link CreateWorkspaceServiceAccountTokenCommandOutput} + * @see {@link CreateWorkspaceServiceAccountTokenCommandInput} for command's `input` shape. + * @see {@link CreateWorkspaceServiceAccountTokenCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request would cause a service quota to be exceeded.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class CreateWorkspaceServiceAccountTokenCommand extends $Command + .classBuilder< + CreateWorkspaceServiceAccountTokenCommandInput, + CreateWorkspaceServiceAccountTokenCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "CreateWorkspaceServiceAccountToken", {}) + .n("GrafanaClient", "CreateWorkspaceServiceAccountTokenCommand") + .f(void 0, CreateWorkspaceServiceAccountTokenResponseFilterSensitiveLog) + .ser(se_CreateWorkspaceServiceAccountTokenCommand) + .de(de_CreateWorkspaceServiceAccountTokenCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/DeleteWorkspaceApiKeyCommand.ts b/clients/client-grafana/src/commands/DeleteWorkspaceApiKeyCommand.ts index d41ea6859ec5..7b283f327f22 100644 --- a/clients/client-grafana/src/commands/DeleteWorkspaceApiKeyCommand.ts +++ b/clients/client-grafana/src/commands/DeleteWorkspaceApiKeyCommand.ts @@ -28,6 +28,10 @@ export interface DeleteWorkspaceApiKeyCommandOutput extends DeleteWorkspaceApiKe /** *

Deletes a Grafana API key for the workspace.

+ * + *

In workspaces compatible with Grafana version 9 or above, use workspace service + * accounts instead of API keys. API keys will be removed in a future release.

+ *
* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountCommand.ts b/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountCommand.ts new file mode 100644 index 000000000000..c14821490f44 --- /dev/null +++ b/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountCommand.ts @@ -0,0 +1,111 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { DeleteWorkspaceServiceAccountRequest, DeleteWorkspaceServiceAccountResponse } from "../models/models_0"; +import { + de_DeleteWorkspaceServiceAccountCommand, + se_DeleteWorkspaceServiceAccountCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link DeleteWorkspaceServiceAccountCommand}. + */ +export interface DeleteWorkspaceServiceAccountCommandInput extends DeleteWorkspaceServiceAccountRequest {} +/** + * @public + * + * The output of {@link DeleteWorkspaceServiceAccountCommand}. + */ +export interface DeleteWorkspaceServiceAccountCommandOutput + extends DeleteWorkspaceServiceAccountResponse, + __MetadataBearer {} + +/** + *

Deletes a workspace service account from the workspace.

+ *

This will delete any tokens created for the service account, as well. If the tokens + * are currently in use, the will fail to authenticate / authorize after they are + * deleted.

+ *

Service accounts are only available for workspaces that are compatible with Grafana + * version 9 and above.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, DeleteWorkspaceServiceAccountCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, DeleteWorkspaceServiceAccountCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // DeleteWorkspaceServiceAccountRequest + * serviceAccountId: "STRING_VALUE", // required + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new DeleteWorkspaceServiceAccountCommand(input); + * const response = await client.send(command); + * // { // DeleteWorkspaceServiceAccountResponse + * // serviceAccountId: "STRING_VALUE", // required + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param DeleteWorkspaceServiceAccountCommandInput - {@link DeleteWorkspaceServiceAccountCommandInput} + * @returns {@link DeleteWorkspaceServiceAccountCommandOutput} + * @see {@link DeleteWorkspaceServiceAccountCommandInput} for command's `input` shape. + * @see {@link DeleteWorkspaceServiceAccountCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class DeleteWorkspaceServiceAccountCommand extends $Command + .classBuilder< + DeleteWorkspaceServiceAccountCommandInput, + DeleteWorkspaceServiceAccountCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "DeleteWorkspaceServiceAccount", {}) + .n("GrafanaClient", "DeleteWorkspaceServiceAccountCommand") + .f(void 0, void 0) + .ser(se_DeleteWorkspaceServiceAccountCommand) + .de(de_DeleteWorkspaceServiceAccountCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountTokenCommand.ts b/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountTokenCommand.ts new file mode 100644 index 000000000000..add67b54e776 --- /dev/null +++ b/clients/client-grafana/src/commands/DeleteWorkspaceServiceAccountTokenCommand.ts @@ -0,0 +1,116 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { + DeleteWorkspaceServiceAccountTokenRequest, + DeleteWorkspaceServiceAccountTokenResponse, +} from "../models/models_0"; +import { + de_DeleteWorkspaceServiceAccountTokenCommand, + se_DeleteWorkspaceServiceAccountTokenCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link DeleteWorkspaceServiceAccountTokenCommand}. + */ +export interface DeleteWorkspaceServiceAccountTokenCommandInput extends DeleteWorkspaceServiceAccountTokenRequest {} +/** + * @public + * + * The output of {@link DeleteWorkspaceServiceAccountTokenCommand}. + */ +export interface DeleteWorkspaceServiceAccountTokenCommandOutput + extends DeleteWorkspaceServiceAccountTokenResponse, + __MetadataBearer {} + +/** + *

Deletes a token for the workspace service account.

+ *

This will disable the key associated with the token. If any automation is currently + * using the key, it will no longer be authenticated or authorized to perform actions with + * the Grafana HTTP APIs.

+ *

Service accounts are only available for workspaces that are compatible with Grafana + * version 9 and above.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, DeleteWorkspaceServiceAccountTokenCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, DeleteWorkspaceServiceAccountTokenCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // DeleteWorkspaceServiceAccountTokenRequest + * tokenId: "STRING_VALUE", // required + * serviceAccountId: "STRING_VALUE", // required + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new DeleteWorkspaceServiceAccountTokenCommand(input); + * const response = await client.send(command); + * // { // DeleteWorkspaceServiceAccountTokenResponse + * // tokenId: "STRING_VALUE", // required + * // serviceAccountId: "STRING_VALUE", // required + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param DeleteWorkspaceServiceAccountTokenCommandInput - {@link DeleteWorkspaceServiceAccountTokenCommandInput} + * @returns {@link DeleteWorkspaceServiceAccountTokenCommandOutput} + * @see {@link DeleteWorkspaceServiceAccountTokenCommandInput} for command's `input` shape. + * @see {@link DeleteWorkspaceServiceAccountTokenCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class DeleteWorkspaceServiceAccountTokenCommand extends $Command + .classBuilder< + DeleteWorkspaceServiceAccountTokenCommandInput, + DeleteWorkspaceServiceAccountTokenCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "DeleteWorkspaceServiceAccountToken", {}) + .n("GrafanaClient", "DeleteWorkspaceServiceAccountTokenCommand") + .f(void 0, void 0) + .ser(se_DeleteWorkspaceServiceAccountTokenCommand) + .de(de_DeleteWorkspaceServiceAccountTokenCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/DescribeWorkspaceAuthenticationCommand.ts b/clients/client-grafana/src/commands/DescribeWorkspaceAuthenticationCommand.ts index 0f8da8d91224..a0a5657d24f7 100644 --- a/clients/client-grafana/src/commands/DescribeWorkspaceAuthenticationCommand.ts +++ b/clients/client-grafana/src/commands/DescribeWorkspaceAuthenticationCommand.ts @@ -100,6 +100,9 @@ export interface DescribeWorkspaceAuthenticationCommandOutput * @throws {@link AccessDeniedException} (client fault) *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

* diff --git a/clients/client-grafana/src/commands/ListWorkspaceServiceAccountTokensCommand.ts b/clients/client-grafana/src/commands/ListWorkspaceServiceAccountTokensCommand.ts new file mode 100644 index 000000000000..d5d90192257f --- /dev/null +++ b/clients/client-grafana/src/commands/ListWorkspaceServiceAccountTokensCommand.ts @@ -0,0 +1,127 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { + ListWorkspaceServiceAccountTokensRequest, + ListWorkspaceServiceAccountTokensResponse, +} from "../models/models_0"; +import { + de_ListWorkspaceServiceAccountTokensCommand, + se_ListWorkspaceServiceAccountTokensCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link ListWorkspaceServiceAccountTokensCommand}. + */ +export interface ListWorkspaceServiceAccountTokensCommandInput extends ListWorkspaceServiceAccountTokensRequest {} +/** + * @public + * + * The output of {@link ListWorkspaceServiceAccountTokensCommand}. + */ +export interface ListWorkspaceServiceAccountTokensCommandOutput + extends ListWorkspaceServiceAccountTokensResponse, + __MetadataBearer {} + +/** + *

Returns a list of tokens for a workspace service account.

+ * + *

This does not return the key for each token. You cannot access keys after they + * are created. To create a new key, delete the token and recreate it.

+ *
+ *

Service accounts are only available for workspaces that are compatible with Grafana + * version 9 and above.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, ListWorkspaceServiceAccountTokensCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, ListWorkspaceServiceAccountTokensCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // ListWorkspaceServiceAccountTokensRequest + * maxResults: Number("int"), + * nextToken: "STRING_VALUE", + * serviceAccountId: "STRING_VALUE", // required + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new ListWorkspaceServiceAccountTokensCommand(input); + * const response = await client.send(command); + * // { // ListWorkspaceServiceAccountTokensResponse + * // nextToken: "STRING_VALUE", + * // serviceAccountTokens: [ // ServiceAccountTokenList // required + * // { // ServiceAccountTokenSummary + * // id: "STRING_VALUE", // required + * // name: "STRING_VALUE", // required + * // createdAt: new Date("TIMESTAMP"), // required + * // expiresAt: new Date("TIMESTAMP"), // required + * // lastUsedAt: new Date("TIMESTAMP"), + * // }, + * // ], + * // serviceAccountId: "STRING_VALUE", // required + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param ListWorkspaceServiceAccountTokensCommandInput - {@link ListWorkspaceServiceAccountTokensCommandInput} + * @returns {@link ListWorkspaceServiceAccountTokensCommandOutput} + * @see {@link ListWorkspaceServiceAccountTokensCommandInput} for command's `input` shape. + * @see {@link ListWorkspaceServiceAccountTokensCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class ListWorkspaceServiceAccountTokensCommand extends $Command + .classBuilder< + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "ListWorkspaceServiceAccountTokens", {}) + .n("GrafanaClient", "ListWorkspaceServiceAccountTokensCommand") + .f(void 0, void 0) + .ser(se_ListWorkspaceServiceAccountTokensCommand) + .de(de_ListWorkspaceServiceAccountTokensCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/ListWorkspaceServiceAccountsCommand.ts b/clients/client-grafana/src/commands/ListWorkspaceServiceAccountsCommand.ts new file mode 100644 index 000000000000..9785871966b8 --- /dev/null +++ b/clients/client-grafana/src/commands/ListWorkspaceServiceAccountsCommand.ts @@ -0,0 +1,117 @@ +// 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 { commonParams } from "../endpoint/EndpointParameters"; +import { GrafanaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GrafanaClient"; +import { ListWorkspaceServiceAccountsRequest, ListWorkspaceServiceAccountsResponse } from "../models/models_0"; +import { + de_ListWorkspaceServiceAccountsCommand, + se_ListWorkspaceServiceAccountsCommand, +} from "../protocols/Aws_restJson1"; + +/** + * @public + */ +export { __MetadataBearer, $Command }; +/** + * @public + * + * The input for {@link ListWorkspaceServiceAccountsCommand}. + */ +export interface ListWorkspaceServiceAccountsCommandInput extends ListWorkspaceServiceAccountsRequest {} +/** + * @public + * + * The output of {@link ListWorkspaceServiceAccountsCommand}. + */ +export interface ListWorkspaceServiceAccountsCommandOutput + extends ListWorkspaceServiceAccountsResponse, + __MetadataBearer {} + +/** + *

Returns a list of service accounts for a workspace.

+ *

Service accounts are only available for workspaces that are compatible with Grafana + * version 9 and above.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { GrafanaClient, ListWorkspaceServiceAccountsCommand } from "@aws-sdk/client-grafana"; // ES Modules import + * // const { GrafanaClient, ListWorkspaceServiceAccountsCommand } = require("@aws-sdk/client-grafana"); // CommonJS import + * const client = new GrafanaClient(config); + * const input = { // ListWorkspaceServiceAccountsRequest + * maxResults: Number("int"), + * nextToken: "STRING_VALUE", + * workspaceId: "STRING_VALUE", // required + * }; + * const command = new ListWorkspaceServiceAccountsCommand(input); + * const response = await client.send(command); + * // { // ListWorkspaceServiceAccountsResponse + * // nextToken: "STRING_VALUE", + * // serviceAccounts: [ // ServiceAccountList // required + * // { // ServiceAccountSummary + * // id: "STRING_VALUE", // required + * // name: "STRING_VALUE", // required + * // isDisabled: "STRING_VALUE", // required + * // grafanaRole: "STRING_VALUE", // required + * // }, + * // ], + * // workspaceId: "STRING_VALUE", // required + * // }; + * + * ``` + * + * @param ListWorkspaceServiceAccountsCommandInput - {@link ListWorkspaceServiceAccountsCommandInput} + * @returns {@link ListWorkspaceServiceAccountsCommandOutput} + * @see {@link ListWorkspaceServiceAccountsCommandInput} for command's `input` shape. + * @see {@link ListWorkspaceServiceAccountsCommandOutput} for command's `response` shape. + * @see {@link GrafanaClientResolvedConfig | config} for GrafanaClient's `config` shape. + * + * @throws {@link AccessDeniedException} (client fault) + *

You do not have sufficient permissions to perform this action.

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

A resource was in an inconsistent state during an update or a deletion.

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

Unexpected error while processing the request. Retry the request.

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

The request references a resource that does not exist.

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

The request was denied because of request throttling. Retry the request.

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

The value of a parameter in the request caused an error.

+ * + * @throws {@link GrafanaServiceException} + *

Base exception class for all service exceptions from Grafana service.

+ * + * @public + */ +export class ListWorkspaceServiceAccountsCommand extends $Command + .classBuilder< + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput, + GrafanaClientResolvedConfig, + ServiceInputTypes, + ServiceOutputTypes + >() + .ep({ + ...commonParams, + }) + .m(function (this: any, Command: any, cs: any, config: GrafanaClientResolvedConfig, o: any) { + return [ + getSerdePlugin(config, this.serialize, this.deserialize), + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), + ]; + }) + .s("AWSGrafanaControlPlane", "ListWorkspaceServiceAccounts", {}) + .n("GrafanaClient", "ListWorkspaceServiceAccountsCommand") + .f(void 0, void 0) + .ser(se_ListWorkspaceServiceAccountsCommand) + .de(de_ListWorkspaceServiceAccountsCommand) + .build() {} diff --git a/clients/client-grafana/src/commands/index.ts b/clients/client-grafana/src/commands/index.ts index 800e6eba03b2..a93b25624907 100644 --- a/clients/client-grafana/src/commands/index.ts +++ b/clients/client-grafana/src/commands/index.ts @@ -2,8 +2,12 @@ export * from "./AssociateLicenseCommand"; export * from "./CreateWorkspaceApiKeyCommand"; export * from "./CreateWorkspaceCommand"; +export * from "./CreateWorkspaceServiceAccountCommand"; +export * from "./CreateWorkspaceServiceAccountTokenCommand"; export * from "./DeleteWorkspaceApiKeyCommand"; export * from "./DeleteWorkspaceCommand"; +export * from "./DeleteWorkspaceServiceAccountCommand"; +export * from "./DeleteWorkspaceServiceAccountTokenCommand"; export * from "./DescribeWorkspaceAuthenticationCommand"; export * from "./DescribeWorkspaceCommand"; export * from "./DescribeWorkspaceConfigurationCommand"; @@ -11,6 +15,8 @@ export * from "./DisassociateLicenseCommand"; export * from "./ListPermissionsCommand"; export * from "./ListTagsForResourceCommand"; export * from "./ListVersionsCommand"; +export * from "./ListWorkspaceServiceAccountTokensCommand"; +export * from "./ListWorkspaceServiceAccountsCommand"; export * from "./ListWorkspacesCommand"; export * from "./TagResourceCommand"; export * from "./UntagResourceCommand"; diff --git a/clients/client-grafana/src/models/models_0.ts b/clients/client-grafana/src/models/models_0.ts index 041b5a25b63b..054ccd50567c 100644 --- a/clients/client-grafana/src/models/models_0.ts +++ b/clients/client-grafana/src/models/models_0.ts @@ -93,7 +93,7 @@ export interface CreateWorkspaceApiKeyRequest { /** *

Specifies the permission level of the key.

- *

Valid values: VIEWER|EDITOR|ADMIN + *

Valid values: ADMIN|EDITOR|VIEWER *

* @public */ @@ -481,7 +481,7 @@ export interface AssociateLicenseRequest { /** *

A token from Grafana Labs that ties your Amazon Web Services account with a Grafana - * Labs account. For more information, see Register with Grafana Labs.

+ * Labs account. For more information, see Link your account with Grafana Labs.

* @public */ grafanaToken?: string; @@ -980,7 +980,7 @@ export interface WorkspaceDescription { /** *

The token that ties this workspace to a Grafana Labs account. For more information, - * see Register with Grafana Labs.

+ * see Link your account with Grafana Labs.

* @public */ grafanaToken?: string; @@ -1644,6 +1644,400 @@ export interface UpdatePermissionsResponse { errors: UpdateError[] | undefined; } +/** + * @public + */ +export interface CreateWorkspaceServiceAccountRequest { + /** + *

A name for the service account. The name must be unique within the workspace, as it + * determines the ID associated with the service account.

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

The permission level to use for this service account.

+ * + *

For more information about the roles and the permissions each has, see User + * roles in the Amazon Managed Grafana User Guide.

+ *
+ * @public + */ + grafanaRole: Role | undefined; + + /** + *

The ID of the workspace within which to create the service account.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface CreateWorkspaceServiceAccountResponse { + /** + *

The ID of the service account.

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

The name of the service account.

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

The permission level given to the service account.

+ * @public + */ + grafanaRole: Role | undefined; + + /** + *

The workspace with which the service account is associated.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface DeleteWorkspaceServiceAccountRequest { + /** + *

The ID of the service account to delete.

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

The ID of the workspace where the service account resides.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface DeleteWorkspaceServiceAccountResponse { + /** + *

The ID of the service account deleted.

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

The ID of the workspace where the service account was deleted.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface ListWorkspaceServiceAccountsRequest { + /** + *

The maximum number of service accounts to include in the results.

+ * @public + */ + maxResults?: number; + + /** + *

The token for the next set of service accounts to return. (You receive this token + * from a previous ListWorkspaceServiceAccounts operation.)

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

The workspace for which to list service accounts.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + *

A structure that contains the information about one service account.

+ * @public + */ +export interface ServiceAccountSummary { + /** + *

The unique ID of the service account.

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

The name of the service account.

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

Returns true if the service account is disabled. Service accounts can be disabled and + * enabled in the Amazon Managed Grafana console.

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

The role of the service account, which sets the permission level used when calling + * Grafana APIs.

+ * @public + */ + grafanaRole: Role | undefined; +} + +/** + * @public + */ +export interface ListWorkspaceServiceAccountsResponse { + /** + *

The token to use when requesting the next set of service accounts.

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

An array of structures containing information about the service accounts.

+ * @public + */ + serviceAccounts: ServiceAccountSummary[] | undefined; + + /** + *

The workspace to which the service accounts are associated.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface CreateWorkspaceServiceAccountTokenRequest { + /** + *

A name for the token to create.

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

Sets how long the token will be valid, in seconds. You can set the time up to 30 + * days in the future.

+ * @public + */ + secondsToLive: number | undefined; + + /** + *

The ID of the service account for which to create a token.

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

The ID of the workspace the service account resides within.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + *

A structure that contains the information about a service account token.

+ *

This structure is returned when creating the token. It is important to store the + * key that is returned, as it is not retrievable at a later time.

+ *

If you lose the key, you can delete and recreate the token, which will create a + * new key.

+ * @public + */ +export interface ServiceAccountTokenSummaryWithKey { + /** + *

The unique ID of the service account token.

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

The name of the service account token.

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

The key for the service account token. Used when making calls to the Grafana HTTP + * APIs to authenticate and authorize the requests.

+ * @public + */ + key: string | undefined; +} + +/** + * @public + */ +export interface CreateWorkspaceServiceAccountTokenResponse { + /** + *

Information about the created token, including the key. Be sure to store the key + * securely.

+ * @public + */ + serviceAccountToken: ServiceAccountTokenSummaryWithKey | undefined; + + /** + *

The ID of the service account where the token was created.

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

The ID of the workspace where the token was created.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface DeleteWorkspaceServiceAccountTokenRequest { + /** + *

The ID of the token to delete.

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

The ID of the service account from which to delete the token.

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

The ID of the workspace from which to delete the token.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface DeleteWorkspaceServiceAccountTokenResponse { + /** + *

The ID of the token that was deleted.

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

The ID of the service account where the token was deleted.

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

The ID of the workspace where the token was deleted.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + * @public + */ +export interface ListWorkspaceServiceAccountTokensRequest { + /** + *

The maximum number of tokens to include in the results.

+ * @public + */ + maxResults?: number; + + /** + *

The token for the next set of service accounts to return. (You receive this token + * from a previous ListWorkspaceServiceAccountTokens operation.)

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

The ID of the service account for which to return tokens.

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

The ID of the workspace for which to return tokens.

+ * @public + */ + workspaceId: string | undefined; +} + +/** + *

A structure that contains the information about a service account token.

+ * @public + */ +export interface ServiceAccountTokenSummary { + /** + *

The unique ID of the service account token.

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

The name of the service account token.

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

When the service account token was created.

+ * @public + */ + createdAt: Date | undefined; + + /** + *

When the service account token will expire.

+ * @public + */ + expiresAt: Date | undefined; + + /** + *

The last time the token was used to authorize a Grafana HTTP API.

+ * @public + */ + lastUsedAt?: Date; +} + +/** + * @public + */ +export interface ListWorkspaceServiceAccountTokensResponse { + /** + *

The token to use when requesting the next set of service accounts.

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

An array of structures containing information about the tokens.

+ * @public + */ + serviceAccountTokens: ServiceAccountTokenSummary[] | undefined; + + /** + *

The ID of the service account where the tokens reside.

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

The ID of the workspace where the tokens reside.

+ * @public + */ + workspaceId: string | undefined; +} + /** * @public */ @@ -1838,7 +2232,7 @@ export interface CreateWorkspaceRequest { /** *

Specifies the version of Grafana to support in the new workspace. If not specified, - * defaults to the latest version (for example, 9.4).

+ * defaults to the latest version (for example, 10.4).

*

To get a list of supported versions, use the ListVersions * operation.

* @public @@ -2004,7 +2398,7 @@ export interface WorkspaceSummary { /** *

The token that ties this workspace to a Grafana Labs account. For more information, - * see Register with Grafana Labs.

+ * see Link your account with Grafana Labs.

* @public */ grafanaToken?: string; @@ -2284,6 +2678,26 @@ export const DisassociateLicenseResponseFilterSensitiveLog = (obj: DisassociateL ...(obj.workspace && { workspace: WorkspaceDescriptionFilterSensitiveLog(obj.workspace) }), }); +/** + * @internal + */ +export const ServiceAccountTokenSummaryWithKeyFilterSensitiveLog = (obj: ServiceAccountTokenSummaryWithKey): any => ({ + ...obj, + ...(obj.key && { key: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const CreateWorkspaceServiceAccountTokenResponseFilterSensitiveLog = ( + obj: CreateWorkspaceServiceAccountTokenResponse +): any => ({ + ...obj, + ...(obj.serviceAccountToken && { + serviceAccountToken: ServiceAccountTokenSummaryWithKeyFilterSensitiveLog(obj.serviceAccountToken), + }), +}); + /** * @internal */ diff --git a/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountTokensPaginator.ts b/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountTokensPaginator.ts new file mode 100644 index 000000000000..0b39c1c1d025 --- /dev/null +++ b/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountTokensPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + ListWorkspaceServiceAccountTokensCommand, + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput, +} from "../commands/ListWorkspaceServiceAccountTokensCommand"; +import { GrafanaClient } from "../GrafanaClient"; +import { GrafanaPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListWorkspaceServiceAccountTokens: ( + config: GrafanaPaginationConfiguration, + input: ListWorkspaceServiceAccountTokensCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + GrafanaPaginationConfiguration, + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput +>(GrafanaClient, ListWorkspaceServiceAccountTokensCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountsPaginator.ts b/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountsPaginator.ts new file mode 100644 index 000000000000..c086be5a9bb8 --- /dev/null +++ b/clients/client-grafana/src/pagination/ListWorkspaceServiceAccountsPaginator.ts @@ -0,0 +1,24 @@ +// smithy-typescript generated code +import { createPaginator } from "@smithy/core"; +import { Paginator } from "@smithy/types"; + +import { + ListWorkspaceServiceAccountsCommand, + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput, +} from "../commands/ListWorkspaceServiceAccountsCommand"; +import { GrafanaClient } from "../GrafanaClient"; +import { GrafanaPaginationConfiguration } from "./Interfaces"; + +/** + * @public + */ +export const paginateListWorkspaceServiceAccounts: ( + config: GrafanaPaginationConfiguration, + input: ListWorkspaceServiceAccountsCommandInput, + ...rest: any[] +) => Paginator = createPaginator< + GrafanaPaginationConfiguration, + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput +>(GrafanaClient, ListWorkspaceServiceAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-grafana/src/pagination/index.ts b/clients/client-grafana/src/pagination/index.ts index 38113d04a479..e1edab3e2082 100644 --- a/clients/client-grafana/src/pagination/index.ts +++ b/clients/client-grafana/src/pagination/index.ts @@ -2,4 +2,6 @@ export * from "./Interfaces"; export * from "./ListPermissionsPaginator"; export * from "./ListVersionsPaginator"; +export * from "./ListWorkspaceServiceAccountTokensPaginator"; +export * from "./ListWorkspaceServiceAccountsPaginator"; export * from "./ListWorkspacesPaginator"; diff --git a/clients/client-grafana/src/protocols/Aws_restJson1.ts b/clients/client-grafana/src/protocols/Aws_restJson1.ts index bff31e2e56ff..61baed7e60f1 100644 --- a/clients/client-grafana/src/protocols/Aws_restJson1.ts +++ b/clients/client-grafana/src/protocols/Aws_restJson1.ts @@ -33,11 +33,27 @@ import { CreateWorkspaceApiKeyCommandOutput, } from "../commands/CreateWorkspaceApiKeyCommand"; import { CreateWorkspaceCommandInput, CreateWorkspaceCommandOutput } from "../commands/CreateWorkspaceCommand"; +import { + CreateWorkspaceServiceAccountCommandInput, + CreateWorkspaceServiceAccountCommandOutput, +} from "../commands/CreateWorkspaceServiceAccountCommand"; +import { + CreateWorkspaceServiceAccountTokenCommandInput, + CreateWorkspaceServiceAccountTokenCommandOutput, +} from "../commands/CreateWorkspaceServiceAccountTokenCommand"; import { DeleteWorkspaceApiKeyCommandInput, DeleteWorkspaceApiKeyCommandOutput, } from "../commands/DeleteWorkspaceApiKeyCommand"; import { DeleteWorkspaceCommandInput, DeleteWorkspaceCommandOutput } from "../commands/DeleteWorkspaceCommand"; +import { + DeleteWorkspaceServiceAccountCommandInput, + DeleteWorkspaceServiceAccountCommandOutput, +} from "../commands/DeleteWorkspaceServiceAccountCommand"; +import { + DeleteWorkspaceServiceAccountTokenCommandInput, + DeleteWorkspaceServiceAccountTokenCommandOutput, +} from "../commands/DeleteWorkspaceServiceAccountTokenCommand"; import { DescribeWorkspaceAuthenticationCommandInput, DescribeWorkspaceAuthenticationCommandOutput, @@ -58,6 +74,14 @@ import { } from "../commands/ListTagsForResourceCommand"; import { ListVersionsCommandInput, ListVersionsCommandOutput } from "../commands/ListVersionsCommand"; import { ListWorkspacesCommandInput, ListWorkspacesCommandOutput } from "../commands/ListWorkspacesCommand"; +import { + ListWorkspaceServiceAccountsCommandInput, + ListWorkspaceServiceAccountsCommandOutput, +} from "../commands/ListWorkspaceServiceAccountsCommand"; +import { + ListWorkspaceServiceAccountTokensCommandInput, + ListWorkspaceServiceAccountTokensCommandOutput, +} from "../commands/ListWorkspaceServiceAccountTokensCommand"; import { TagResourceCommandInput, TagResourceCommandOutput } from "../commands/TagResourceCommand"; import { UntagResourceCommandInput, UntagResourceCommandOutput } from "../commands/UntagResourceCommand"; import { UpdatePermissionsCommandInput, UpdatePermissionsCommandOutput } from "../commands/UpdatePermissionsCommand"; @@ -84,6 +108,7 @@ import { ResourceNotFoundException, RoleValues, SamlConfiguration, + ServiceAccountTokenSummary, ServiceQuotaExceededException, ThrottlingException, UpdateInstruction, @@ -176,6 +201,55 @@ export const se_CreateWorkspaceApiKeyCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1CreateWorkspaceServiceAccountCommand + */ +export const se_CreateWorkspaceServiceAccountCommand = async ( + input: CreateWorkspaceServiceAccountCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/workspaces/{workspaceId}/serviceaccounts"); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + let body: any; + body = JSON.stringify( + take(input, { + grafanaRole: [], + name: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + +/** + * serializeAws_restJson1CreateWorkspaceServiceAccountTokenCommand + */ +export const se_CreateWorkspaceServiceAccountTokenCommand = async ( + input: CreateWorkspaceServiceAccountTokenCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = { + "content-type": "application/json", + }; + b.bp("/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens"); + b.p("serviceAccountId", () => input.serviceAccountId!, "{serviceAccountId}", false); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + let body: any; + body = JSON.stringify( + take(input, { + name: [], + secondsToLive: [], + }) + ); + b.m("POST").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1DeleteWorkspaceCommand */ @@ -209,6 +283,41 @@ export const se_DeleteWorkspaceApiKeyCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1DeleteWorkspaceServiceAccountCommand + */ +export const se_DeleteWorkspaceServiceAccountCommand = async ( + input: DeleteWorkspaceServiceAccountCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}"); + b.p("serviceAccountId", () => input.serviceAccountId!, "{serviceAccountId}", false); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + let body: any; + b.m("DELETE").h(headers).b(body); + return b.build(); +}; + +/** + * serializeAws_restJson1DeleteWorkspaceServiceAccountTokenCommand + */ +export const se_DeleteWorkspaceServiceAccountTokenCommand = async ( + input: DeleteWorkspaceServiceAccountTokenCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens/{tokenId}"); + b.p("tokenId", () => input.tokenId!, "{tokenId}", false); + b.p("serviceAccountId", () => input.serviceAccountId!, "{serviceAccountId}", false); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + let body: any; + b.m("DELETE").h(headers).b(body); + return b.build(); +}; + /** * serializeAws_restJson1DescribeWorkspaceCommand */ @@ -352,6 +461,47 @@ export const se_ListWorkspacesCommand = async ( return b.build(); }; +/** + * serializeAws_restJson1ListWorkspaceServiceAccountsCommand + */ +export const se_ListWorkspaceServiceAccountsCommand = async ( + input: ListWorkspaceServiceAccountsCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/workspaces/{workspaceId}/serviceaccounts"); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + const query: any = map({ + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], + }); + let body: any; + b.m("GET").h(headers).q(query).b(body); + return b.build(); +}; + +/** + * serializeAws_restJson1ListWorkspaceServiceAccountTokensCommand + */ +export const se_ListWorkspaceServiceAccountTokensCommand = async ( + input: ListWorkspaceServiceAccountTokensCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const b = rb(input, context); + const headers: any = {}; + b.bp("/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens"); + b.p("serviceAccountId", () => input.serviceAccountId!, "{serviceAccountId}", false); + b.p("workspaceId", () => input.workspaceId!, "{workspaceId}", false); + const query: any = map({ + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], + }); + let body: any; + b.m("GET").h(headers).q(query).b(body); + return b.build(); +}; + /** * serializeAws_restJson1TagResourceCommand */ @@ -569,6 +719,53 @@ export const de_CreateWorkspaceApiKeyCommand = async ( return contents; }; +/** + * deserializeAws_restJson1CreateWorkspaceServiceAccountCommand + */ +export const de_CreateWorkspaceServiceAccountCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + grafanaRole: __expectString, + id: __expectString, + name: __expectString, + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1CreateWorkspaceServiceAccountTokenCommand + */ +export const de_CreateWorkspaceServiceAccountTokenCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + serviceAccountId: __expectString, + serviceAccountToken: _json, + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1DeleteWorkspaceCommand */ @@ -612,6 +809,51 @@ export const de_DeleteWorkspaceApiKeyCommand = async ( return contents; }; +/** + * deserializeAws_restJson1DeleteWorkspaceServiceAccountCommand + */ +export const de_DeleteWorkspaceServiceAccountCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + serviceAccountId: __expectString, + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1DeleteWorkspaceServiceAccountTokenCommand + */ +export const de_DeleteWorkspaceServiceAccountTokenCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + serviceAccountId: __expectString, + tokenId: __expectString, + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1DescribeWorkspaceCommand */ @@ -784,6 +1026,53 @@ export const de_ListWorkspacesCommand = async ( return contents; }; +/** + * deserializeAws_restJson1ListWorkspaceServiceAccountsCommand + */ +export const de_ListWorkspaceServiceAccountsCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + nextToken: __expectString, + serviceAccounts: _json, + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + +/** + * deserializeAws_restJson1ListWorkspaceServiceAccountTokensCommand + */ +export const de_ListWorkspaceServiceAccountTokensCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode !== 200 && 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, { + nextToken: __expectString, + serviceAccountId: __expectString, + serviceAccountTokens: (_) => de_ServiceAccountTokenList(_, context), + workspaceId: __expectString, + }); + Object.assign(contents, doc); + return contents; +}; + /** * deserializeAws_restJson1TagResourceCommand */ @@ -1169,6 +1458,37 @@ const de_ValidationExceptionRes = async (parsedOutput: any, context: __SerdeCont // de_SecurityGroupIds omitted. +// de_ServiceAccountList omitted. + +// de_ServiceAccountSummary omitted. + +/** + * deserializeAws_restJson1ServiceAccountTokenList + */ +const de_ServiceAccountTokenList = (output: any, context: __SerdeContext): ServiceAccountTokenSummary[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + return de_ServiceAccountTokenSummary(entry, context); + }); + return retVal; +}; + +/** + * deserializeAws_restJson1ServiceAccountTokenSummary + */ +const de_ServiceAccountTokenSummary = (output: any, context: __SerdeContext): ServiceAccountTokenSummary => { + return take(output, { + createdAt: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + expiresAt: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + id: __expectString, + lastUsedAt: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + name: __expectString, + }) as any; +}; + +// de_ServiceAccountTokenSummaryWithKey omitted. + // de_SubnetIds omitted. // de_TagMap omitted. diff --git a/codegen/sdk-codegen/aws-models/grafana.json b/codegen/sdk-codegen/aws-models/grafana.json index e5779beb6846..39117874f77a 100644 --- a/codegen/sdk-codegen/aws-models/grafana.json +++ b/codegen/sdk-codegen/aws-models/grafana.json @@ -34,6 +34,12 @@ { "target": "com.amazonaws.grafana#Permission" }, + { + "target": "com.amazonaws.grafana#ServiceAccount" + }, + { + "target": "com.amazonaws.grafana#ServiceAccountToken" + }, { "target": "com.amazonaws.grafana#Workspace" } @@ -981,7 +987,7 @@ } ], "traits": { - "smithy.api#documentation": "

Assigns a Grafana Enterprise license to a workspace. Upgrading to Grafana Enterprise\n incurs additional fees. For more information, see Upgrade a\n workspace to Grafana Enterprise.

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

Assigns a Grafana Enterprise license to a workspace. To upgrade, you must use\n ENTERPRISE for the licenseType, and pass in a valid\n Grafana Labs token for the grafanaToken. Upgrading to Grafana Enterprise\n incurs additional fees. For more information, see Upgrade a\n workspace to Grafana Enterprise.

", "smithy.api#http": { "code": 202, "method": "POST", @@ -1011,7 +1017,7 @@ "grafanaToken": { "target": "com.amazonaws.grafana#GrafanaToken", "traits": { - "smithy.api#documentation": "

A token from Grafana Labs that ties your Amazon Web Services account with a Grafana \n Labs account. For more information, see Register with Grafana Labs.

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

A token from Grafana Labs that ties your Amazon Web Services account with a Grafana \n Labs account. For more information, see Link your account with Grafana Labs.

", "smithy.api#httpHeader": "Grafana-Token" } } @@ -1262,7 +1268,7 @@ } ], "traits": { - "smithy.api#documentation": "

Creates a Grafana API key for the workspace. This key can be used to authenticate\n requests sent to the workspace's HTTP API. See https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html\n for available APIs and example requests.

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

Creates a Grafana API key for the workspace. This key can be used to authenticate\n requests sent to the workspace's HTTP API. See https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html\n for available APIs and example requests.

\n \n

In workspaces compatible with Grafana version 9 or above, use workspace service \n accounts instead of API keys. API keys will be removed in a future release.

\n
", "smithy.api#http": { "code": 200, "method": "POST", @@ -1283,7 +1289,7 @@ "keyRole": { "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

Specifies the permission level of the key.

\n

Valid values: VIEWER|EDITOR|ADMIN\n

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

Specifies the permission level of the key.

\n

Valid values: ADMIN|EDITOR|VIEWER\n

", "smithy.api#required": {} } }, @@ -1440,7 +1446,7 @@ "grafanaVersion": { "target": "com.amazonaws.grafana#GrafanaVersion", "traits": { - "smithy.api#documentation": "

Specifies the version of Grafana to support in the new workspace. If not specified, \n defaults to the latest version (for example, 9.4).

\n

To get a list of supported versions, use the ListVersions\n operation.

" + "smithy.api#documentation": "

Specifies the version of Grafana to support in the new workspace. If not specified, \n defaults to the latest version (for example, 10.4).

\n

To get a list of supported versions, use the ListVersions\n operation.

" } } } @@ -1457,6 +1463,223 @@ } } }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccount": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccountRequest" + }, + "output": { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccountResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ServiceQuotaExceededException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a service account for the workspace. A service account can be used to call \n Grafana HTTP APIs, and run automated workloads. After creating the service account with\n the correct GrafanaRole for your use case, use \n CreateWorkspaceServiceAccountToken to create a token that can be used to\n authenticate and authorize Grafana HTTP API calls.

\n

You can only create service accounts for workspaces that are compatible with Grafana\n version 9 and above.

\n \n

For more information about service accounts, see Service accounts in \n the Amazon Managed Grafana User Guide.

\n

For more information about the Grafana HTTP APIs, see Using Grafana HTTP \n APIs in the Amazon Managed Grafana User Guide.

\n
", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/workspaces/{workspaceId}/serviceaccounts" + } + } + }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccountRequest": { + "type": "structure", + "members": { + "name": { + "target": "com.amazonaws.grafana#ServiceAccountName", + "traits": { + "smithy.api#documentation": "

A name for the service account. The name must be unique within the workspace, as it\n determines the ID associated with the service account.

", + "smithy.api#required": {} + } + }, + "grafanaRole": { + "target": "com.amazonaws.grafana#Role", + "traits": { + "smithy.api#documentation": "

The permission level to use for this service account.

\n \n

For more information about the roles and the permissions each has, see User\n roles in the Amazon Managed Grafana User Guide.

\n
", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace within which to create the service account.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccountResponse": { + "type": "structure", + "members": { + "id": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account.

", + "smithy.api#required": {} + } + }, + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The name of the service account.

", + "smithy.api#required": {} + } + }, + "grafanaRole": { + "target": "com.amazonaws.grafana#Role", + "traits": { + "smithy.api#documentation": "

The permission level given to the service account.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The workspace with which the service account is associated.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccountToken": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccountTokenRequest" + }, + "output": { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccountTokenResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ServiceQuotaExceededException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a token that can be used to authenticate and authorize Grafana HTTP API\n operations for the given workspace service \n account. The service account acts as a user for the API operations, and\n defines the permissions that are used by the API.

\n \n

When you create the service account token, you will receive a key that is used\n when calling Grafana APIs. Do not lose this key, as it will not be retrievable\n again.

\n

If you do lose the key, you can delete the token and recreate it to receive a \n new key. This will disable the initial key.

\n
\n

Service accounts are only available for workspaces that are compatible with Grafana\n version 9 and above.

", + "smithy.api#http": { + "code": 200, + "method": "POST", + "uri": "/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens" + } + } + }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccountTokenRequest": { + "type": "structure", + "members": { + "name": { + "target": "com.amazonaws.grafana#ServiceAccountTokenName", + "traits": { + "smithy.api#documentation": "

A name for the token to create.

", + "smithy.api#required": {} + } + }, + "secondsToLive": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "

Sets how long the token will be valid, in seconds. You can set the time up to 30 \n days in the future.

", + "smithy.api#range": { + "min": 1, + "max": 2592000 + }, + "smithy.api#required": {} + } + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account for which to create a token.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace the service account resides within.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.grafana#CreateWorkspaceServiceAccountTokenResponse": { + "type": "structure", + "members": { + "serviceAccountToken": { + "target": "com.amazonaws.grafana#ServiceAccountTokenSummaryWithKey", + "traits": { + "smithy.api#documentation": "

Information about the created token, including the key. Be sure to store the key\n securely.

", + "smithy.api#required": {} + } + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account where the token was created.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace where the token was created.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.grafana#DataSourceType": { "type": "string", "traits": { @@ -1582,7 +1805,7 @@ } ], "traits": { - "smithy.api#documentation": "

Deletes a Grafana API key for the workspace.

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

Deletes a Grafana API key for the workspace.

\n \n

In workspaces compatible with Grafana version 9 or above, use workspace service \n accounts instead of API keys. API keys will be removed in a future release.

\n
", "smithy.api#http": { "code": 200, "method": "DELETE", @@ -1655,18 +1878,21 @@ } } }, - "com.amazonaws.grafana#DescribeWorkspace": { + "com.amazonaws.grafana#DeleteWorkspaceServiceAccount": { "type": "operation", "input": { - "target": "com.amazonaws.grafana#DescribeWorkspaceRequest" + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccountRequest" }, "output": { - "target": "com.amazonaws.grafana#DescribeWorkspaceResponse" + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccountResponse" }, "errors": [ { "target": "com.amazonaws.grafana#AccessDeniedException" }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, { "target": "com.amazonaws.grafana#InternalServerException" }, @@ -1681,27 +1907,75 @@ } ], "traits": { - "smithy.api#documentation": "

Displays information about one Amazon Managed Grafana workspace.

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

Deletes a workspace service account from the workspace.

\n

This will delete any tokens created for the service account, as well. If the tokens\n are currently in use, the will fail to authenticate / authorize after they are \n deleted.

\n

Service accounts are only available for workspaces that are compatible with Grafana\n version 9 and above.

", "smithy.api#http": { "code": 200, - "method": "GET", - "uri": "/workspaces/{workspaceId}" + "method": "DELETE", + "uri": "/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}" + } + } + }, + "com.amazonaws.grafana#DeleteWorkspaceServiceAccountRequest": { + "type": "structure", + "members": { + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account to delete.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } }, - "smithy.api#readonly": {} + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace where the service account resides.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} } }, - "com.amazonaws.grafana#DescribeWorkspaceAuthentication": { + "com.amazonaws.grafana#DeleteWorkspaceServiceAccountResponse": { + "type": "structure", + "members": { + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account deleted.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace where the service account was deleted.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.grafana#DeleteWorkspaceServiceAccountToken": { "type": "operation", "input": { - "target": "com.amazonaws.grafana#DescribeWorkspaceAuthenticationRequest" + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccountTokenRequest" }, "output": { - "target": "com.amazonaws.grafana#DescribeWorkspaceAuthenticationResponse" + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccountTokenResponse" }, "errors": [ { "target": "com.amazonaws.grafana#AccessDeniedException" }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, { "target": "com.amazonaws.grafana#InternalServerException" }, @@ -1716,29 +1990,162 @@ } ], "traits": { - "smithy.api#documentation": "

Displays information about the authentication methods used in one Amazon Managed Grafana\n workspace.

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

Deletes a token for the workspace service account.

\n

This will disable the key associated with the token. If any automation is currently \n using the key, it will no longer be authenticated or authorized to perform actions with \n the Grafana HTTP APIs.

\n

Service accounts are only available for workspaces that are compatible with Grafana\n version 9 and above.

", "smithy.api#http": { "code": 200, - "method": "GET", - "uri": "/workspaces/{workspaceId}/authentication" - }, - "smithy.api#readonly": {} + "method": "DELETE", + "uri": "/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens/{tokenId}" + } } }, - "com.amazonaws.grafana#DescribeWorkspaceAuthenticationRequest": { + "com.amazonaws.grafana#DeleteWorkspaceServiceAccountTokenRequest": { "type": "structure", "members": { - "workspaceId": { - "target": "com.amazonaws.grafana#WorkspaceId", + "tokenId": { + "target": "smithy.api#String", "traits": { - "smithy.api#documentation": "

The ID of the workspace to return authentication information about.

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

The ID of the token to delete.

", "smithy.api#httpLabel": {}, "smithy.api#required": {} } - } - } - }, - "com.amazonaws.grafana#DescribeWorkspaceAuthenticationResponse": { + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account from which to delete the token.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace from which to delete the token.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.grafana#DeleteWorkspaceServiceAccountTokenResponse": { + "type": "structure", + "members": { + "tokenId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the token that was deleted.

", + "smithy.api#required": {} + } + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account where the token was deleted.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace where the token was deleted.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.grafana#DescribeWorkspace": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#DescribeWorkspaceRequest" + }, + "output": { + "target": "com.amazonaws.grafana#DescribeWorkspaceResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Displays information about one Amazon Managed Grafana workspace.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/workspaces/{workspaceId}" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.grafana#DescribeWorkspaceAuthentication": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#DescribeWorkspaceAuthenticationRequest" + }, + "output": { + "target": "com.amazonaws.grafana#DescribeWorkspaceAuthenticationResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Displays information about the authentication methods used in one Amazon Managed Grafana\n workspace.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/workspaces/{workspaceId}/authentication" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.grafana#DescribeWorkspaceAuthenticationRequest": { + "type": "structure", + "members": { + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace to return authentication information about.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.grafana#DescribeWorkspaceAuthenticationResponse": { "type": "structure", "members": { "authentication": { @@ -2322,6 +2729,237 @@ "smithy.api#output": {} } }, + "com.amazonaws.grafana#ListWorkspaceServiceAccountTokens": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccountTokensRequest" + }, + "output": { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccountTokensResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns a list of tokens for a workspace service account.

\n \n

This does not return the key for each token. You cannot access keys after they\n are created. To create a new key, delete the token and recreate it.

\n
\n

Service accounts are only available for workspaces that are compatible with Grafana\n version 9 and above.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens" + }, + "smithy.api#paginated": { + "inputToken": "nextToken", + "outputToken": "nextToken", + "pageSize": "maxResults", + "items": "serviceAccountTokens" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.grafana#ListWorkspaceServiceAccountTokensRequest": { + "type": "structure", + "members": { + "maxResults": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "

The maximum number of tokens to include in the results.

", + "smithy.api#httpQuery": "maxResults", + "smithy.api#range": { + "min": 1, + "max": 100 + } + } + }, + "nextToken": { + "target": "com.amazonaws.grafana#PaginationToken", + "traits": { + "aws.cloudformation#cfnExcludeProperty": {}, + "smithy.api#documentation": "

The token for the next set of service accounts to return. (You receive this token\n from a previous ListWorkspaceServiceAccountTokens operation.)

", + "smithy.api#httpQuery": "nextToken" + } + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account for which to return tokens.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace for which to return tokens.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.grafana#ListWorkspaceServiceAccountTokensResponse": { + "type": "structure", + "members": { + "nextToken": { + "target": "com.amazonaws.grafana#PaginationToken", + "traits": { + "aws.cloudformation#cfnExcludeProperty": {}, + "smithy.api#documentation": "

The token to use when requesting the next set of service accounts.

" + } + }, + "serviceAccountTokens": { + "target": "com.amazonaws.grafana#ServiceAccountTokenList", + "traits": { + "smithy.api#documentation": "

An array of structures containing information about the tokens.

", + "smithy.api#required": {} + } + }, + "serviceAccountId": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The ID of the service account where the tokens reside.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The ID of the workspace where the tokens reside.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, + "com.amazonaws.grafana#ListWorkspaceServiceAccounts": { + "type": "operation", + "input": { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccountsRequest" + }, + "output": { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccountsResponse" + }, + "errors": [ + { + "target": "com.amazonaws.grafana#AccessDeniedException" + }, + { + "target": "com.amazonaws.grafana#ConflictException" + }, + { + "target": "com.amazonaws.grafana#InternalServerException" + }, + { + "target": "com.amazonaws.grafana#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.grafana#ThrottlingException" + }, + { + "target": "com.amazonaws.grafana#ValidationException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns a list of service accounts for a workspace.

\n

Service accounts are only available for workspaces that are compatible with Grafana\n version 9 and above.

", + "smithy.api#http": { + "code": 200, + "method": "GET", + "uri": "/workspaces/{workspaceId}/serviceaccounts" + }, + "smithy.api#paginated": { + "inputToken": "nextToken", + "outputToken": "nextToken", + "pageSize": "maxResults", + "items": "serviceAccounts" + }, + "smithy.api#readonly": {} + } + }, + "com.amazonaws.grafana#ListWorkspaceServiceAccountsRequest": { + "type": "structure", + "members": { + "maxResults": { + "target": "smithy.api#Integer", + "traits": { + "smithy.api#documentation": "

The maximum number of service accounts to include in the results.

", + "smithy.api#httpQuery": "maxResults", + "smithy.api#range": { + "min": 1, + "max": 100 + } + } + }, + "nextToken": { + "target": "com.amazonaws.grafana#PaginationToken", + "traits": { + "aws.cloudformation#cfnExcludeProperty": {}, + "smithy.api#documentation": "

The token for the next set of service accounts to return. (You receive this token\n from a previous ListWorkspaceServiceAccounts operation.)

", + "smithy.api#httpQuery": "nextToken" + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The workspace for which to list service accounts.

", + "smithy.api#httpLabel": {}, + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.grafana#ListWorkspaceServiceAccountsResponse": { + "type": "structure", + "members": { + "nextToken": { + "target": "com.amazonaws.grafana#PaginationToken", + "traits": { + "aws.cloudformation#cfnExcludeProperty": {}, + "smithy.api#documentation": "

The token to use when requesting the next set of service accounts.

" + } + }, + "serviceAccounts": { + "target": "com.amazonaws.grafana#ServiceAccountList", + "traits": { + "smithy.api#documentation": "

An array of structures containing information about the service accounts.

", + "smithy.api#required": {} + } + }, + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId", + "traits": { + "smithy.api#documentation": "

The workspace to which the service accounts are associated.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.grafana#ListWorkspaces": { "type": "operation", "input": { @@ -2755,6 +3393,200 @@ } } }, + "com.amazonaws.grafana#ServiceAccount": { + "type": "resource", + "identifiers": { + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId" + } + }, + "operations": [ + { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccount" + }, + { + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccount" + }, + { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccounts" + } + ], + "traits": { + "aws.api#arn": { + "template": "workspaces/{workspaceId}/serviceaccounts" + } + } + }, + "com.amazonaws.grafana#ServiceAccountList": { + "type": "list", + "member": { + "target": "com.amazonaws.grafana#ServiceAccountSummary" + } + }, + "com.amazonaws.grafana#ServiceAccountName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + } + } + }, + "com.amazonaws.grafana#ServiceAccountSummary": { + "type": "structure", + "members": { + "id": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The unique ID of the service account.

", + "smithy.api#required": {} + } + }, + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The name of the service account.

", + "smithy.api#required": {} + } + }, + "isDisabled": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

Returns true if the service account is disabled. Service accounts can be disabled and\n enabled in the Amazon Managed Grafana console.

", + "smithy.api#required": {} + } + }, + "grafanaRole": { + "target": "com.amazonaws.grafana#Role", + "traits": { + "smithy.api#documentation": "

The role of the service account, which sets the permission level used when calling\n Grafana APIs.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A structure that contains the information about one service account.

" + } + }, + "com.amazonaws.grafana#ServiceAccountToken": { + "type": "resource", + "identifiers": { + "workspaceId": { + "target": "com.amazonaws.grafana#WorkspaceId" + }, + "serviceAccountId": { + "target": "smithy.api#String" + } + }, + "operations": [ + { + "target": "com.amazonaws.grafana#CreateWorkspaceServiceAccountToken" + }, + { + "target": "com.amazonaws.grafana#DeleteWorkspaceServiceAccountToken" + }, + { + "target": "com.amazonaws.grafana#ListWorkspaceServiceAccountTokens" + } + ], + "traits": { + "aws.api#arn": { + "template": "workspaces/{workspaceId}/serviceaccounts/{serviceAccountId}/tokens" + } + } + }, + "com.amazonaws.grafana#ServiceAccountTokenKey": { + "type": "string", + "traits": { + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.grafana#ServiceAccountTokenList": { + "type": "list", + "member": { + "target": "com.amazonaws.grafana#ServiceAccountTokenSummary" + } + }, + "com.amazonaws.grafana#ServiceAccountTokenName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + } + } + }, + "com.amazonaws.grafana#ServiceAccountTokenSummary": { + "type": "structure", + "members": { + "id": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The unique ID of the service account token.

", + "smithy.api#required": {} + } + }, + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The name of the service account token.

", + "smithy.api#required": {} + } + }, + "createdAt": { + "target": "smithy.api#Timestamp", + "traits": { + "smithy.api#documentation": "

When the service account token was created.

", + "smithy.api#required": {} + } + }, + "expiresAt": { + "target": "smithy.api#Timestamp", + "traits": { + "smithy.api#documentation": "

When the service account token will expire.

", + "smithy.api#required": {} + } + }, + "lastUsedAt": { + "target": "smithy.api#Timestamp", + "traits": { + "smithy.api#documentation": "

The last time the token was used to authorize a Grafana HTTP API.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

A structure that contains the information about a service account token.

" + } + }, + "com.amazonaws.grafana#ServiceAccountTokenSummaryWithKey": { + "type": "structure", + "members": { + "id": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The unique ID of the service account token.

", + "smithy.api#required": {} + } + }, + "name": { + "target": "smithy.api#String", + "traits": { + "smithy.api#documentation": "

The name of the service account token.

", + "smithy.api#required": {} + } + }, + "key": { + "target": "com.amazonaws.grafana#ServiceAccountTokenKey", + "traits": { + "smithy.api#documentation": "

The key for the service account token. Used when making calls to the Grafana HTTP \n APIs to authenticate and authorize the requests.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A structure that contains the information about a service account token.

\n

This structure is returned when creating the token. It is important to store the\n key that is returned, as it is not retrievable at a later time.

\n

If you lose the key, you can delete and recreate the token, which will create a\n new key.

" + } + }, "com.amazonaws.grafana#ServiceQuotaExceededException": { "type": "structure", "members": { @@ -3826,7 +4658,7 @@ "grafanaToken": { "target": "com.amazonaws.grafana#GrafanaToken", "traits": { - "smithy.api#documentation": "

The token that ties this workspace to a Grafana Labs account. For more information, \n see Register with Grafana Labs.

" + "smithy.api#documentation": "

The token that ties this workspace to a Grafana Labs account. For more information, \n see Link your account with Grafana Labs.

" } } }, @@ -4010,7 +4842,7 @@ "grafanaToken": { "target": "com.amazonaws.grafana#GrafanaToken", "traits": { - "smithy.api#documentation": "

The token that ties this workspace to a Grafana Labs account. For more information, \n see Register with Grafana Labs.

" + "smithy.api#documentation": "

The token that ties this workspace to a Grafana Labs account. For more information, \n see Link your account with Grafana Labs.

" } } },