Skip to content

Commit

Permalink
feat(client-grafana): This release includes support for configuring a…
Browse files Browse the repository at this point in the history
… Grafana workspace to connect to a datasource within a VPC as well as new APIs for configuring Grafana settings.
  • Loading branch information
awstools committed Nov 23, 2022
1 parent 3a5313a commit b6cf732
Show file tree
Hide file tree
Showing 19 changed files with 1,326 additions and 375 deletions.
140 changes: 107 additions & 33 deletions clients/client-grafana/src/Grafana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import {
DescribeWorkspaceCommandInput,
DescribeWorkspaceCommandOutput,
} from "./commands/DescribeWorkspaceCommand";
import {
DescribeWorkspaceConfigurationCommand,
DescribeWorkspaceConfigurationCommandInput,
DescribeWorkspaceConfigurationCommandOutput,
} from "./commands/DescribeWorkspaceConfigurationCommand";
import {
DisassociateLicenseCommand,
DisassociateLicenseCommandInput,
Expand Down Expand Up @@ -77,6 +82,11 @@ import {
UpdateWorkspaceCommandInput,
UpdateWorkspaceCommandOutput,
} from "./commands/UpdateWorkspaceCommand";
import {
UpdateWorkspaceConfigurationCommand,
UpdateWorkspaceConfigurationCommandInput,
UpdateWorkspaceConfigurationCommandOutput,
} from "./commands/UpdateWorkspaceConfigurationCommand";
import { GrafanaClient } from "./GrafanaClient";

/**
Expand All @@ -91,8 +101,8 @@ import { GrafanaClient } from "./GrafanaClient";
export class Grafana extends GrafanaClient {
/**
* <p>Assigns a Grafana Enterprise license to a workspace. Upgrading to Grafana Enterprise
* incurs additional fees. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/upgrade-to-Grafana-Enterprise.html">Upgrade a workspace to
* Grafana Enterprise</a>.</p>
* incurs additional fees. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/upgrade-to-Grafana-Enterprise.html">Upgrade a workspace to
* Grafana Enterprise</a>.</p>
*/
public associateLicense(
args: AssociateLicenseCommandInput,
Expand Down Expand Up @@ -125,10 +135,10 @@ export class Grafana extends GrafanaClient {

/**
* <p>Creates a <i>workspace</i>. In a workspace, you can create Grafana
* dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to
* build, package, or deploy any hardware to run the Grafana server.</p>
* <p>Don't use <code>CreateWorkspace</code> to modify an existing workspace. Instead,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html">UpdateWorkspace</a>.</p>
* dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to
* build, package, or deploy any hardware to run the Grafana server.</p>
* <p>Don't use <code>CreateWorkspace</code> to modify an existing workspace. Instead,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html">UpdateWorkspace</a>.</p>
*/
public createWorkspace(
args: CreateWorkspaceCommandInput,
Expand Down Expand Up @@ -160,10 +170,10 @@ export class Grafana extends GrafanaClient {
}

/**
* <p>Creates an API key for the workspace. This key can be used to authenticate
* requests sent to the workspace's HTTP API. See
* <a href=" https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html"> https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html</a>
* for available APIs and example requests.</p>
* <p>Creates a Grafana API key for the workspace. This key can be used to
* authenticate requests sent to the workspace's HTTP API.
* See <a href="https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html">https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html</a>
* for available APIs and example requests.</p>
*/
public createWorkspaceApiKey(
args: CreateWorkspaceApiKeyCommandInput,
Expand Down Expand Up @@ -227,7 +237,7 @@ export class Grafana extends GrafanaClient {
}

/**
* <p>Deletes an API key for a workspace.</p>
* <p>Deletes a Grafana API key for the workspace.</p>
*/
public deleteWorkspaceApiKey(
args: DeleteWorkspaceApiKeyCommandInput,
Expand Down Expand Up @@ -322,6 +332,38 @@ export class Grafana extends GrafanaClient {
}
}

/**
* <p>Gets the current configuration string for the given workspace.</p>
*/
public describeWorkspaceConfiguration(
args: DescribeWorkspaceConfigurationCommandInput,
options?: __HttpHandlerOptions
): Promise<DescribeWorkspaceConfigurationCommandOutput>;
public describeWorkspaceConfiguration(
args: DescribeWorkspaceConfigurationCommandInput,
cb: (err: any, data?: DescribeWorkspaceConfigurationCommandOutput) => void
): void;
public describeWorkspaceConfiguration(
args: DescribeWorkspaceConfigurationCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DescribeWorkspaceConfigurationCommandOutput) => void
): void;
public describeWorkspaceConfiguration(
args: DescribeWorkspaceConfigurationCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DescribeWorkspaceConfigurationCommandOutput) => void),
cb?: (err: any, data?: DescribeWorkspaceConfigurationCommandOutput) => void
): Promise<DescribeWorkspaceConfigurationCommandOutput> | void {
const command = new DescribeWorkspaceConfigurationCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Removes the Grafana Enterprise license from a workspace.</p>
*/
Expand Down Expand Up @@ -356,12 +398,12 @@ export class Grafana extends GrafanaClient {

/**
* <p>Lists the users and groups who have the Grafana <code>Admin</code> and
* <code>Editor</code> roles in this workspace. If you use this
* operation without specifying <code>userId</code> or <code>groupId</code>, the operation returns
* the roles of all users
* and groups. If you specify a <code>userId</code> or a <code>groupId</code>, only the roles
* for that user or group are returned. If you do this, you can specify only one <code>userId</code> or
* one <code>groupId</code>.</p>
* <code>Editor</code> roles in this workspace. If you use this
* operation without specifying <code>userId</code> or <code>groupId</code>, the operation returns
* the roles of all users
* and groups. If you specify a <code>userId</code> or a <code>groupId</code>, only the roles
* for that user or group are returned. If you do this, you can specify only one <code>userId</code> or
* one <code>groupId</code>.</p>
*/
public listPermissions(
args: ListPermissionsCommandInput,
Expand Down Expand Up @@ -394,8 +436,8 @@ export class Grafana extends GrafanaClient {

/**
* <p>The <code>ListTagsForResource</code> operation returns the tags that
* are associated with the Amazon Managed Service for Grafana resource specified by the <code>resourceArn</code>.
* Currently, the only resource that can be tagged is a workspace. </p>
* are associated with the Amazon Managed Service for Grafana resource specified by the <code>resourceArn</code>.
* Currently, the only resource that can be tagged is a workspace. </p>
*/
public listTagsForResource(
args: ListTagsForResourceCommandInput,
Expand Down Expand Up @@ -428,7 +470,7 @@ export class Grafana extends GrafanaClient {

/**
* <p>Returns a list of Amazon Managed Grafana workspaces in the account, with some information
* about each workspace. For more complete information about one workspace, use <a href="https://docs.aws.amazon.com/AAMG/latest/APIReference/API_DescribeWorkspace.html">DescribeWorkspace</a>.</p>
* about each workspace. For more complete information about one workspace, use <a href="https://docs.aws.amazon.com/AAMG/latest/APIReference/API_DescribeWorkspace.html">DescribeWorkspace</a>.</p>
*/
public listWorkspaces(
args: ListWorkspacesCommandInput,
Expand Down Expand Up @@ -461,10 +503,10 @@ export class Grafana extends GrafanaClient {

/**
* <p>The <code>TagResource</code> operation associates tags with an Amazon Managed Grafana resource.
* Currently, the only resource that can be tagged is workspaces. </p>
* <p>If you specify a new tag key for the resource, this tag is appended to the list of tags associated
* with the resource. If you specify a tag key that is already associated with the resource, the new tag
* value that you specify replaces the previous value for that tag.</p>
* Currently, the only resource that can be tagged is workspaces. </p>
* <p>If you specify a new tag key for the resource, this tag is appended to the list of tags associated
* with the resource. If you specify a tag key that is already associated with the resource, the new tag
* value that you specify replaces the previous value for that tag.</p>
*/
public tagResource(args: TagResourceCommandInput, options?: __HttpHandlerOptions): Promise<TagResourceCommandOutput>;
public tagResource(args: TagResourceCommandInput, cb: (err: any, data?: TagResourceCommandOutput) => void): void;
Expand All @@ -491,7 +533,7 @@ export class Grafana extends GrafanaClient {

/**
* <p>The <code>UntagResource</code> operation removes the association of the tag with the Amazon Managed Grafana resource.
* </p>
* </p>
*/
public untagResource(
args: UntagResourceCommandInput,
Expand Down Expand Up @@ -556,11 +598,11 @@ export class Grafana extends GrafanaClient {

/**
* <p>Modifies an existing Amazon Managed Grafana workspace. If you use this operation and omit any
* optional parameters, the existing values of those parameters are not changed.</p>
* <p>To modify the user authentication methods that the workspace uses, such as SAML or Amazon Web Services SSO,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspaceAuthentication.html">UpdateWorkspaceAuthentication</a>.</p>
* <p>To modify which users in the workspace have the <code>Admin</code> and <code>Editor</code> Grafana roles,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdatePermissions.html">UpdatePermissions</a>.</p>
* optional parameters, the existing values of those parameters are not changed.</p>
* <p>To modify the user authentication methods that the workspace uses, such as SAML or IAM Identity Center,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspaceAuthentication.html">UpdateWorkspaceAuthentication</a>.</p>
* <p>To modify which users in the workspace have the <code>Admin</code> and <code>Editor</code> Grafana roles,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdatePermissions.html">UpdatePermissions</a>.</p>
*/
public updateWorkspace(
args: UpdateWorkspaceCommandInput,
Expand Down Expand Up @@ -593,9 +635,9 @@ export class Grafana extends GrafanaClient {

/**
* <p>Use this operation to define the identity provider (IdP) that this workspace
* authenticates users from, using SAML. You can also map SAML assertion attributes to
* workspace user information and define which groups in the assertion attribute are to have
* the <code>Admin</code> and <code>Editor</code> roles in the workspace.</p>
* authenticates users from, using SAML. You can also map SAML assertion attributes to
* workspace user information and define which groups in the assertion attribute are to have
* the <code>Admin</code> and <code>Editor</code> roles in the workspace.</p>
*/
public updateWorkspaceAuthentication(
args: UpdateWorkspaceAuthenticationCommandInput,
Expand Down Expand Up @@ -625,4 +667,36 @@ export class Grafana extends GrafanaClient {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Updates the configuration string for the given workspace</p>
*/
public updateWorkspaceConfiguration(
args: UpdateWorkspaceConfigurationCommandInput,
options?: __HttpHandlerOptions
): Promise<UpdateWorkspaceConfigurationCommandOutput>;
public updateWorkspaceConfiguration(
args: UpdateWorkspaceConfigurationCommandInput,
cb: (err: any, data?: UpdateWorkspaceConfigurationCommandOutput) => void
): void;
public updateWorkspaceConfiguration(
args: UpdateWorkspaceConfigurationCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateWorkspaceConfigurationCommandOutput) => void
): void;
public updateWorkspaceConfiguration(
args: UpdateWorkspaceConfigurationCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: UpdateWorkspaceConfigurationCommandOutput) => void),
cb?: (err: any, data?: UpdateWorkspaceConfigurationCommandOutput) => void
): Promise<UpdateWorkspaceConfigurationCommandOutput> | void {
const command = new UpdateWorkspaceConfigurationCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}
}
16 changes: 14 additions & 2 deletions clients/client-grafana/src/GrafanaClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ import {
DescribeWorkspaceAuthenticationCommandOutput,
} from "./commands/DescribeWorkspaceAuthenticationCommand";
import { DescribeWorkspaceCommandInput, DescribeWorkspaceCommandOutput } from "./commands/DescribeWorkspaceCommand";
import {
DescribeWorkspaceConfigurationCommandInput,
DescribeWorkspaceConfigurationCommandOutput,
} from "./commands/DescribeWorkspaceConfigurationCommand";
import {
DisassociateLicenseCommandInput,
DisassociateLicenseCommandOutput,
Expand All @@ -81,6 +85,10 @@ import {
UpdateWorkspaceAuthenticationCommandOutput,
} from "./commands/UpdateWorkspaceAuthenticationCommand";
import { UpdateWorkspaceCommandInput, UpdateWorkspaceCommandOutput } from "./commands/UpdateWorkspaceCommand";
import {
UpdateWorkspaceConfigurationCommandInput,
UpdateWorkspaceConfigurationCommandOutput,
} from "./commands/UpdateWorkspaceConfigurationCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand All @@ -97,6 +105,7 @@ export type ServiceInputTypes =
| DeleteWorkspaceCommandInput
| DescribeWorkspaceAuthenticationCommandInput
| DescribeWorkspaceCommandInput
| DescribeWorkspaceConfigurationCommandInput
| DisassociateLicenseCommandInput
| ListPermissionsCommandInput
| ListTagsForResourceCommandInput
Expand All @@ -105,7 +114,8 @@ export type ServiceInputTypes =
| UntagResourceCommandInput
| UpdatePermissionsCommandInput
| UpdateWorkspaceAuthenticationCommandInput
| UpdateWorkspaceCommandInput;
| UpdateWorkspaceCommandInput
| UpdateWorkspaceConfigurationCommandInput;

export type ServiceOutputTypes =
| AssociateLicenseCommandOutput
Expand All @@ -115,6 +125,7 @@ export type ServiceOutputTypes =
| DeleteWorkspaceCommandOutput
| DescribeWorkspaceAuthenticationCommandOutput
| DescribeWorkspaceCommandOutput
| DescribeWorkspaceConfigurationCommandOutput
| DisassociateLicenseCommandOutput
| ListPermissionsCommandOutput
| ListTagsForResourceCommandOutput
Expand All @@ -123,7 +134,8 @@ export type ServiceOutputTypes =
| UntagResourceCommandOutput
| UpdatePermissionsCommandOutput
| UpdateWorkspaceAuthenticationCommandOutput
| UpdateWorkspaceCommandOutput;
| UpdateWorkspaceCommandOutput
| UpdateWorkspaceConfigurationCommandOutput;

export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface AssociateLicenseCommandOutput extends AssociateLicenseResponse,

/**
* <p>Assigns a Grafana Enterprise license to a workspace. Upgrading to Grafana Enterprise
* incurs additional fees. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/upgrade-to-Grafana-Enterprise.html">Upgrade a workspace to
* Grafana Enterprise</a>.</p>
* incurs additional fees. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/upgrade-to-Grafana-Enterprise.html">Upgrade a workspace to
* Grafana Enterprise</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export interface CreateWorkspaceApiKeyCommandInput extends CreateWorkspaceApiKey
export interface CreateWorkspaceApiKeyCommandOutput extends CreateWorkspaceApiKeyResponse, __MetadataBearer {}

/**
* <p>Creates an API key for the workspace. This key can be used to authenticate
* requests sent to the workspace's HTTP API. See
* <a href=" https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html"> https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html</a>
* for available APIs and example requests.</p>
* <p>Creates a Grafana API key for the workspace. This key can be used to
* authenticate requests sent to the workspace's HTTP API.
* See <a href="https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html">https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html</a>
* for available APIs and example requests.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
8 changes: 4 additions & 4 deletions clients/client-grafana/src/commands/CreateWorkspaceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export interface CreateWorkspaceCommandOutput extends CreateWorkspaceResponse, _

/**
* <p>Creates a <i>workspace</i>. In a workspace, you can create Grafana
* dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to
* build, package, or deploy any hardware to run the Grafana server.</p>
* <p>Don't use <code>CreateWorkspace</code> to modify an existing workspace. Instead,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html">UpdateWorkspace</a>.</p>
* dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to
* build, package, or deploy any hardware to run the Grafana server.</p>
* <p>Don't use <code>CreateWorkspace</code> to modify an existing workspace. Instead,
* use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html">UpdateWorkspace</a>.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface DeleteWorkspaceApiKeyCommandInput extends DeleteWorkspaceApiKey
export interface DeleteWorkspaceApiKeyCommandOutput extends DeleteWorkspaceApiKeyResponse, __MetadataBearer {}

/**
* <p>Deletes an API key for a workspace.</p>
* <p>Deletes a Grafana API key for the workspace.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Loading

0 comments on commit b6cf732

Please sign in to comment.