Skip to content

Commit

Permalink
feat(client-greengrassv2): This release adds the new DeleteDeployment…
Browse files Browse the repository at this point in the history
… API operation that you can use to delete deployment resources. This release also adds support for discontinued AWS-provided components, so AWS can communicate when a component has any issues that you should consider before you deploy it.
  • Loading branch information
awstools committed May 18, 2022
1 parent 3fe961f commit fe02b18
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 50 deletions.
128 changes: 126 additions & 2 deletions clients/client-greengrassv2/src/GreengrassV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ import {
DeleteCoreDeviceCommandInput,
DeleteCoreDeviceCommandOutput,
} from "./commands/DeleteCoreDeviceCommand";
import {
DeleteDeploymentCommand,
DeleteDeploymentCommandInput,
DeleteDeploymentCommandOutput,
} from "./commands/DeleteDeploymentCommand";
import {
DescribeComponentCommand,
DescribeComponentCommandInput,
Expand Down Expand Up @@ -344,17 +349,29 @@ export class GreengrassV2 extends GreengrassV2Client {
* </p>
* </li>
* <li>
* <p>Python 3.9 – <code>python3.9</code>
* </p>
* </li>
* <li>
* <p>Java 8 – <code>java8</code>
* </p>
* </li>
* <li>
* <p>Java 11 – <code>java11</code>
* </p>
* </li>
* <li>
* <p>Node.js 10 – <code>nodejs10.x</code>
* </p>
* </li>
* <li>
* <p>Node.js 12 – <code>nodejs12.x</code>
* </p>
* </li>
* <li>
* <p>Node.js 14 – <code>nodejs14.x</code>
* </p>
* </li>
* </ul>
* <p>To create a component from a Lambda function, specify <code>lambdaFunction</code>
* when you call this operation.</p>
Expand Down Expand Up @@ -508,6 +525,42 @@ export class GreengrassV2 extends GreengrassV2Client {
}
}

/**
* <p>Deletes a deployment. To delete an active deployment, you must first cancel it. For more
* information, see <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_CancelDeployment.html">CancelDeployment</a>.</p>
* <p>Deleting a deployment doesn't affect core devices that run that deployment, because core
* devices store the deployment's configuration on the device. Additionally, core devices can
* roll back to a previous deployment that has been deleted.</p>
*/
public deleteDeployment(
args: DeleteDeploymentCommandInput,
options?: __HttpHandlerOptions
): Promise<DeleteDeploymentCommandOutput>;
public deleteDeployment(
args: DeleteDeploymentCommandInput,
cb: (err: any, data?: DeleteDeploymentCommandOutput) => void
): void;
public deleteDeployment(
args: DeleteDeploymentCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DeleteDeploymentCommandOutput) => void
): void;
public deleteDeployment(
args: DeleteDeploymentCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DeleteDeploymentCommandOutput) => void),
cb?: (err: any, data?: DeleteDeploymentCommandOutput) => void
): Promise<DeleteDeploymentCommandOutput> | void {
const command = new DeleteDeploymentCommand(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>Retrieves metadata for a version of a component.</p>
*/
Expand Down Expand Up @@ -606,7 +659,7 @@ export class GreengrassV2 extends GreengrassV2Client {
}

/**
* <p>Gets the pre-signed URL to download a public component artifact. Core devices call this
* <p>Gets the pre-signed URL to download a public or a Lambda component artifact. Core devices call this
* operation to identify the URL that they can use to download an artifact to install.</p>
*/
public getComponentVersionArtifact(
Expand Down Expand Up @@ -678,6 +731,29 @@ export class GreengrassV2 extends GreengrassV2Client {

/**
* <p>Retrieves metadata for a Greengrass core device.</p>
* <note>
* <p>IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core
* software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then
* the reported status of that device might not reflect its current status. The status timestamp
* indicates when the device status was last updated.</p>
* <p>Core devices send status updates at the following times:</p>
* <ul>
* <li>
* <p>When the IoT Greengrass Core software starts</p>
* </li>
* <li>
* <p>When the core device receives a deployment from the Amazon Web Services Cloud</p>
* </li>
* <li>
* <p>When the status of any component on the core device becomes <code>BROKEN</code>
* </p>
* </li>
* <li>
* <p>At a <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration-fss">regular interval
* that you can configure</a>, which defaults to 24 hours</p>
* </li>
* </ul>
* </note>
*/
public getCoreDevice(
args: GetCoreDeviceCommandInput,
Expand Down Expand Up @@ -877,6 +953,29 @@ export class GreengrassV2 extends GreengrassV2Client {

/**
* <p>Retrieves a paginated list of Greengrass core devices.</p>
* <note>
* <p>IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core
* software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then
* the reported status of that device might not reflect its current status. The status timestamp
* indicates when the device status was last updated.</p>
* <p>Core devices send status updates at the following times:</p>
* <ul>
* <li>
* <p>When the IoT Greengrass Core software starts</p>
* </li>
* <li>
* <p>When the core device receives a deployment from the Amazon Web Services Cloud</p>
* </li>
* <li>
* <p>When the status of any component on the core device becomes <code>BROKEN</code>
* </p>
* </li>
* <li>
* <p>At a <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration-fss">regular interval
* that you can configure</a>, which defaults to 24 hours</p>
* </li>
* </ul>
* </note>
*/
public listCoreDevices(
args: ListCoreDevicesCommandInput,
Expand Down Expand Up @@ -973,7 +1072,32 @@ export class GreengrassV2 extends GreengrassV2Client {
}

/**
* <p>Retrieves a paginated list of the components that a Greengrass core device runs.</p>
* <p>Retrieves a paginated list of the components that a Greengrass core device runs.
* This list doesn't include components that are deployed from local deployments or
* components that are deployed as dependencies of other components.</p>
* <note>
* <p>IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core
* software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then
* the reported status of that device might not reflect its current status. The status timestamp
* indicates when the device status was last updated.</p>
* <p>Core devices send status updates at the following times:</p>
* <ul>
* <li>
* <p>When the IoT Greengrass Core software starts</p>
* </li>
* <li>
* <p>When the core device receives a deployment from the Amazon Web Services Cloud</p>
* </li>
* <li>
* <p>When the status of any component on the core device becomes <code>BROKEN</code>
* </p>
* </li>
* <li>
* <p>At a <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration-fss">regular interval
* that you can configure</a>, which defaults to 24 hours</p>
* </li>
* </ul>
* </note>
*/
public listInstalledComponents(
args: ListInstalledComponentsCommandInput,
Expand Down
3 changes: 3 additions & 0 deletions clients/client-greengrassv2/src/GreengrassV2Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import {
import { CreateDeploymentCommandInput, CreateDeploymentCommandOutput } from "./commands/CreateDeploymentCommand";
import { DeleteComponentCommandInput, DeleteComponentCommandOutput } from "./commands/DeleteComponentCommand";
import { DeleteCoreDeviceCommandInput, DeleteCoreDeviceCommandOutput } from "./commands/DeleteCoreDeviceCommand";
import { DeleteDeploymentCommandInput, DeleteDeploymentCommandOutput } from "./commands/DeleteDeploymentCommand";
import { DescribeComponentCommandInput, DescribeComponentCommandOutput } from "./commands/DescribeComponentCommand";
import {
DisassociateServiceRoleFromAccountCommandInput,
Expand Down Expand Up @@ -136,6 +137,7 @@ export type ServiceInputTypes =
| CreateDeploymentCommandInput
| DeleteComponentCommandInput
| DeleteCoreDeviceCommandInput
| DeleteDeploymentCommandInput
| DescribeComponentCommandInput
| DisassociateServiceRoleFromAccountCommandInput
| GetComponentCommandInput
Expand Down Expand Up @@ -166,6 +168,7 @@ export type ServiceOutputTypes =
| CreateDeploymentCommandOutput
| DeleteComponentCommandOutput
| DeleteCoreDeviceCommandOutput
| DeleteDeploymentCommandOutput
| DescribeComponentCommandOutput
| DisassociateServiceRoleFromAccountCommandOutput
| GetComponentCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,29 @@ export interface CreateComponentVersionCommandOutput extends CreateComponentVers
* </p>
* </li>
* <li>
* <p>Python 3.9 – <code>python3.9</code>
* </p>
* </li>
* <li>
* <p>Java 8 – <code>java8</code>
* </p>
* </li>
* <li>
* <p>Java 11 – <code>java11</code>
* </p>
* </li>
* <li>
* <p>Node.js 10 – <code>nodejs10.x</code>
* </p>
* </li>
* <li>
* <p>Node.js 12 – <code>nodejs12.x</code>
* </p>
* </li>
* <li>
* <p>Node.js 14 – <code>nodejs14.x</code>
* </p>
* </li>
* </ul>
* <p>To create a component from a Lambda function, specify <code>lambdaFunction</code>
* when you call this operation.</p>
Expand Down
100 changes: 100 additions & 0 deletions clients/client-greengrassv2/src/commands/DeleteDeploymentCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// smithy-typescript generated code
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 { GreengrassV2ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../GreengrassV2Client";
import { DeleteDeploymentRequest } from "../models/models_0";
import {
deserializeAws_restJson1DeleteDeploymentCommand,
serializeAws_restJson1DeleteDeploymentCommand,
} from "../protocols/Aws_restJson1";

export interface DeleteDeploymentCommandInput extends DeleteDeploymentRequest {}
export interface DeleteDeploymentCommandOutput extends __MetadataBearer {}

/**
* <p>Deletes a deployment. To delete an active deployment, you must first cancel it. For more
* information, see <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_CancelDeployment.html">CancelDeployment</a>.</p>
* <p>Deleting a deployment doesn't affect core devices that run that deployment, because core
* devices store the deployment's configuration on the device. Additionally, core devices can
* roll back to a previous deployment that has been deleted.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { GreengrassV2Client, DeleteDeploymentCommand } from "@aws-sdk/client-greengrassv2"; // ES Modules import
* // const { GreengrassV2Client, DeleteDeploymentCommand } = require("@aws-sdk/client-greengrassv2"); // CommonJS import
* const client = new GreengrassV2Client(config);
* const command = new DeleteDeploymentCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link DeleteDeploymentCommandInput} for command's `input` shape.
* @see {@link DeleteDeploymentCommandOutput} for command's `response` shape.
* @see {@link GreengrassV2ClientResolvedConfig | config} for GreengrassV2Client's `config` shape.
*
*/
export class DeleteDeploymentCommand extends $Command<
DeleteDeploymentCommandInput,
DeleteDeploymentCommandOutput,
GreengrassV2ClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

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

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: GreengrassV2ClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<DeleteDeploymentCommandInput, DeleteDeploymentCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

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

const { logger } = configuration;
const clientName = "GreengrassV2Client";
const commandName = "DeleteDeploymentCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: DeleteDeploymentRequest.filterSensitiveLog,
outputFilterSensitiveLog: (output: any) => output,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface GetComponentVersionArtifactCommandOutput
__MetadataBearer {}

/**
* <p>Gets the pre-signed URL to download a public component artifact. Core devices call this
* <p>Gets the pre-signed URL to download a public or a Lambda component artifact. Core devices call this
* operation to identify the URL that they can use to download an artifact to install.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
23 changes: 23 additions & 0 deletions clients/client-greengrassv2/src/commands/GetCoreDeviceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ export interface GetCoreDeviceCommandOutput extends GetCoreDeviceResponse, __Met

/**
* <p>Retrieves metadata for a Greengrass core device.</p>
* <note>
* <p>IoT Greengrass relies on individual devices to send status updates to the Amazon Web Services Cloud. If the IoT Greengrass Core
* software isn't running on the device, or if device isn't connected to the Amazon Web Services Cloud, then
* the reported status of that device might not reflect its current status. The status timestamp
* indicates when the device status was last updated.</p>
* <p>Core devices send status updates at the following times:</p>
* <ul>
* <li>
* <p>When the IoT Greengrass Core software starts</p>
* </li>
* <li>
* <p>When the core device receives a deployment from the Amazon Web Services Cloud</p>
* </li>
* <li>
* <p>When the status of any component on the core device becomes <code>BROKEN</code>
* </p>
* </li>
* <li>
* <p>At a <a href="https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html#greengrass-nucleus-component-configuration-fss">regular interval
* that you can configure</a>, which defaults to 24 hours</p>
* </li>
* </ul>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Loading

0 comments on commit fe02b18

Please sign in to comment.