Skip to content

Commit

Permalink
feat(client-license-manager): AWS License Manager now supports onboar…
Browse files Browse the repository at this point in the history
…ded Management Accounts or Delegated Admins to view granted licenses aggregated from all accounts in the organization.
  • Loading branch information
awstools committed Nov 11, 2022
1 parent 65b66c7 commit 63e5da1
Show file tree
Hide file tree
Showing 9 changed files with 1,807 additions and 783 deletions.
78 changes: 78 additions & 0 deletions clients/client-license-manager/src/LicenseManager.ts
Expand Up @@ -153,11 +153,21 @@ import {
ListReceivedGrantsCommandInput,
ListReceivedGrantsCommandOutput,
} from "./commands/ListReceivedGrantsCommand";
import {
ListReceivedGrantsForOrganizationCommand,
ListReceivedGrantsForOrganizationCommandInput,
ListReceivedGrantsForOrganizationCommandOutput,
} from "./commands/ListReceivedGrantsForOrganizationCommand";
import {
ListReceivedLicensesCommand,
ListReceivedLicensesCommandInput,
ListReceivedLicensesCommandOutput,
} from "./commands/ListReceivedLicensesCommand";
import {
ListReceivedLicensesForOrganizationCommand,
ListReceivedLicensesForOrganizationCommandInput,
ListReceivedLicensesForOrganizationCommandOutput,
} from "./commands/ListReceivedLicensesForOrganizationCommand";
import {
ListResourceInventoryCommand,
ListResourceInventoryCommandInput,
Expand Down Expand Up @@ -300,6 +310,10 @@ export class LicenseManager extends LicenseManagerClient {

/**
* <p>Checks out the specified license.</p>
* <note>
* <p>If the account that created the license is the same that is performing the check out, you must
* specify the account as the beneficiary.</p>
* </note>
*/
public checkoutLicense(
args: CheckoutLicenseCommandInput,
Expand Down Expand Up @@ -1336,6 +1350,38 @@ export class LicenseManager extends LicenseManagerClient {
}
}

/**
* <p>Lists the grants received for all accounts in the organization.</p>
*/
public listReceivedGrantsForOrganization(
args: ListReceivedGrantsForOrganizationCommandInput,
options?: __HttpHandlerOptions
): Promise<ListReceivedGrantsForOrganizationCommandOutput>;
public listReceivedGrantsForOrganization(
args: ListReceivedGrantsForOrganizationCommandInput,
cb: (err: any, data?: ListReceivedGrantsForOrganizationCommandOutput) => void
): void;
public listReceivedGrantsForOrganization(
args: ListReceivedGrantsForOrganizationCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListReceivedGrantsForOrganizationCommandOutput) => void
): void;
public listReceivedGrantsForOrganization(
args: ListReceivedGrantsForOrganizationCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListReceivedGrantsForOrganizationCommandOutput) => void),
cb?: (err: any, data?: ListReceivedGrantsForOrganizationCommandOutput) => void
): Promise<ListReceivedGrantsForOrganizationCommandOutput> | void {
const command = new ListReceivedGrantsForOrganizationCommand(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>Lists received licenses.</p>
*/
Expand Down Expand Up @@ -1368,6 +1414,38 @@ export class LicenseManager extends LicenseManagerClient {
}
}

/**
* <p>Lists the licenses received for all accounts in the organization.</p>
*/
public listReceivedLicensesForOrganization(
args: ListReceivedLicensesForOrganizationCommandInput,
options?: __HttpHandlerOptions
): Promise<ListReceivedLicensesForOrganizationCommandOutput>;
public listReceivedLicensesForOrganization(
args: ListReceivedLicensesForOrganizationCommandInput,
cb: (err: any, data?: ListReceivedLicensesForOrganizationCommandOutput) => void
): void;
public listReceivedLicensesForOrganization(
args: ListReceivedLicensesForOrganizationCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ListReceivedLicensesForOrganizationCommandOutput) => void
): void;
public listReceivedLicensesForOrganization(
args: ListReceivedLicensesForOrganizationCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: ListReceivedLicensesForOrganizationCommandOutput) => void),
cb?: (err: any, data?: ListReceivedLicensesForOrganizationCommandOutput) => void
): Promise<ListReceivedLicensesForOrganizationCommandOutput> | void {
const command = new ListReceivedLicensesForOrganizationCommand(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>Lists resources managed using Systems Manager inventory.</p>
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-license-manager/src/LicenseManagerClient.ts
Expand Up @@ -140,10 +140,18 @@ import {
ListLicenseVersionsCommandOutput,
} from "./commands/ListLicenseVersionsCommand";
import { ListReceivedGrantsCommandInput, ListReceivedGrantsCommandOutput } from "./commands/ListReceivedGrantsCommand";
import {
ListReceivedGrantsForOrganizationCommandInput,
ListReceivedGrantsForOrganizationCommandOutput,
} from "./commands/ListReceivedGrantsForOrganizationCommand";
import {
ListReceivedLicensesCommandInput,
ListReceivedLicensesCommandOutput,
} from "./commands/ListReceivedLicensesCommand";
import {
ListReceivedLicensesForOrganizationCommandInput,
ListReceivedLicensesForOrganizationCommandOutput,
} from "./commands/ListReceivedLicensesForOrganizationCommand";
import {
ListResourceInventoryCommandInput,
ListResourceInventoryCommandOutput,
Expand Down Expand Up @@ -221,7 +229,9 @@ export type ServiceInputTypes =
| ListLicenseVersionsCommandInput
| ListLicensesCommandInput
| ListReceivedGrantsCommandInput
| ListReceivedGrantsForOrganizationCommandInput
| ListReceivedLicensesCommandInput
| ListReceivedLicensesForOrganizationCommandInput
| ListResourceInventoryCommandInput
| ListTagsForResourceCommandInput
| ListTokensCommandInput
Expand Down Expand Up @@ -271,7 +281,9 @@ export type ServiceOutputTypes =
| ListLicenseVersionsCommandOutput
| ListLicensesCommandOutput
| ListReceivedGrantsCommandOutput
| ListReceivedGrantsForOrganizationCommandOutput
| ListReceivedLicensesCommandOutput
| ListReceivedLicensesForOrganizationCommandOutput
| ListResourceInventoryCommandOutput
| ListTagsForResourceCommandOutput
| ListTokensCommandOutput
Expand Down
Expand Up @@ -30,6 +30,10 @@ export interface CheckoutLicenseCommandOutput extends CheckoutLicenseResponse, _

/**
* <p>Checks out the specified license.</p>
* <note>
* <p>If the account that created the license is the same that is performing the check out, you must
* specify the account as the beneficiary.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
@@ -0,0 +1,122 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { LicenseManagerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LicenseManagerClient";
import {
ListReceivedGrantsForOrganizationRequest,
ListReceivedGrantsForOrganizationRequestFilterSensitiveLog,
ListReceivedGrantsForOrganizationResponse,
ListReceivedGrantsForOrganizationResponseFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_json1_1ListReceivedGrantsForOrganizationCommand,
serializeAws_json1_1ListReceivedGrantsForOrganizationCommand,
} from "../protocols/Aws_json1_1";

export interface ListReceivedGrantsForOrganizationCommandInput extends ListReceivedGrantsForOrganizationRequest {}
export interface ListReceivedGrantsForOrganizationCommandOutput
extends ListReceivedGrantsForOrganizationResponse,
__MetadataBearer {}

/**
* <p>Lists the grants received for all accounts in the organization.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LicenseManagerClient, ListReceivedGrantsForOrganizationCommand } from "@aws-sdk/client-license-manager"; // ES Modules import
* // const { LicenseManagerClient, ListReceivedGrantsForOrganizationCommand } = require("@aws-sdk/client-license-manager"); // CommonJS import
* const client = new LicenseManagerClient(config);
* const command = new ListReceivedGrantsForOrganizationCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link ListReceivedGrantsForOrganizationCommandInput} for command's `input` shape.
* @see {@link ListReceivedGrantsForOrganizationCommandOutput} for command's `response` shape.
* @see {@link LicenseManagerClientResolvedConfig | config} for LicenseManagerClient's `config` shape.
*
*/
export class ListReceivedGrantsForOrganizationCommand extends $Command<
ListReceivedGrantsForOrganizationCommandInput,
ListReceivedGrantsForOrganizationCommandOutput,
LicenseManagerClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

constructor(readonly input: ListReceivedGrantsForOrganizationCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: LicenseManagerClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<ListReceivedGrantsForOrganizationCommandInput, ListReceivedGrantsForOrganizationCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, ListReceivedGrantsForOrganizationCommand.getEndpointParameterInstructions())
);

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "LicenseManagerClient";
const commandName = "ListReceivedGrantsForOrganizationCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: ListReceivedGrantsForOrganizationRequestFilterSensitiveLog,
outputFilterSensitiveLog: ListReceivedGrantsForOrganizationResponseFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(
input: ListReceivedGrantsForOrganizationCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return serializeAws_json1_1ListReceivedGrantsForOrganizationCommand(input, context);
}

private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<ListReceivedGrantsForOrganizationCommandOutput> {
return deserializeAws_json1_1ListReceivedGrantsForOrganizationCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}

0 comments on commit 63e5da1

Please sign in to comment.