Skip to content

Commit

Permalink
chore(clients): upgrade to smithy 1.27.2 (#4387)
Browse files Browse the repository at this point in the history
  • Loading branch information
srchase authored Jan 31, 2023
1 parent 92c1230 commit caee754
Show file tree
Hide file tree
Showing 48 changed files with 3,020 additions and 177 deletions.
2 changes: 1 addition & 1 deletion codegen/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
smithyVersion=1.26.4
smithyVersion=1.27.2
smithyGradleVersion=0.6.0
14 changes: 7 additions & 7 deletions private/aws-protocoltests-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ using your favorite package manager:

The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the `EC2ProtocolClient` and
the commands you need, for example `EmptyInputAndEmptyOutputCommand`:
the commands you need, for example `DatetimeOffsetsCommand`:

```js
// ES5 example
const { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } = require("@aws-sdk/aws-protocoltests-ec2");
const { EC2ProtocolClient, DatetimeOffsetsCommand } = require("@aws-sdk/aws-protocoltests-ec2");
```

```ts
// ES6+ example
import { EC2ProtocolClient, EmptyInputAndEmptyOutputCommand } from "@aws-sdk/aws-protocoltests-ec2";
import { EC2ProtocolClient, DatetimeOffsetsCommand } from "@aws-sdk/aws-protocoltests-ec2";
```

### Usage
Expand All @@ -54,7 +54,7 @@ const client = new EC2ProtocolClient({ region: "REGION" });
const params = {
/** input parameters */
};
const command = new EmptyInputAndEmptyOutputCommand(params);
const command = new DatetimeOffsetsCommand(params);
```

#### Async/await
Expand Down Expand Up @@ -133,15 +133,15 @@ const client = new AWS.EC2Protocol({ region: "REGION" });

// async/await.
try {
const data = await client.emptyInputAndEmptyOutput(params);
const data = await client.datetimeOffsets(params);
// process data.
} catch (error) {
// error handling.
}

// Promises.
client
.emptyInputAndEmptyOutput(params)
.datetimeOffsets(params)
.then((data) => {
// process data.
})
Expand All @@ -150,7 +150,7 @@ client
});

// callbacks.
client.emptyInputAndEmptyOutput(params, (err, data) => {
client.datetimeOffsets(params, (err, data) => {
// process err and data.
});
```
Expand Down
34 changes: 34 additions & 0 deletions private/aws-protocoltests-ec2/src/EC2Protocol.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// smithy-typescript generated code
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";

import {
DatetimeOffsetsCommand,
DatetimeOffsetsCommandInput,
DatetimeOffsetsCommandOutput,
} from "./commands/DatetimeOffsetsCommand";
import {
EmptyInputAndEmptyOutputCommand,
EmptyInputAndEmptyOutputCommandInput,
Expand Down Expand Up @@ -97,6 +102,35 @@ import { EC2ProtocolClient } from "./EC2ProtocolClient";
* An EC2 query service that sends query requests and XML responses.
*/
export class EC2Protocol extends EC2ProtocolClient {
public datetimeOffsets(
args: DatetimeOffsetsCommandInput,
options?: __HttpHandlerOptions
): Promise<DatetimeOffsetsCommandOutput>;
public datetimeOffsets(
args: DatetimeOffsetsCommandInput,
cb: (err: any, data?: DatetimeOffsetsCommandOutput) => void
): void;
public datetimeOffsets(
args: DatetimeOffsetsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DatetimeOffsetsCommandOutput) => void
): void;
public datetimeOffsets(
args: DatetimeOffsetsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DatetimeOffsetsCommandOutput) => void),
cb?: (err: any, data?: DatetimeOffsetsCommandOutput) => void
): Promise<DatetimeOffsetsCommandOutput> | void {
const command = new DatetimeOffsetsCommand(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);
}
}

/**
* The example tests how requests and responses are serialized when there's
* no request or response members.
Expand Down
3 changes: 3 additions & 0 deletions private/aws-protocoltests-ec2/src/EC2ProtocolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
UserAgent as __UserAgent,
} from "@aws-sdk/types";

import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "./commands/DatetimeOffsetsCommand";
import {
EmptyInputAndEmptyOutputCommandInput,
EmptyInputAndEmptyOutputCommandOutput,
Expand Down Expand Up @@ -91,6 +92,7 @@ import { XmlTimestampsCommandInput, XmlTimestampsCommandOutput } from "./command
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";

export type ServiceInputTypes =
| DatetimeOffsetsCommandInput
| EmptyInputAndEmptyOutputCommandInput
| EndpointOperationCommandInput
| EndpointWithHostLabelOperationCommandInput
Expand All @@ -115,6 +117,7 @@ export type ServiceInputTypes =
| XmlTimestampsCommandInput;

export type ServiceOutputTypes =
| DatetimeOffsetsCommandOutput
| EmptyInputAndEmptyOutputCommandOutput
| EndpointOperationCommandOutput
| EndpointWithHostLabelOperationCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// 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 { EC2ProtocolClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EC2ProtocolClient";
import { DatetimeOffsetsOutput, DatetimeOffsetsOutputFilterSensitiveLog } from "../models/models_0";
import { deserializeAws_ec2DatetimeOffsetsCommand, serializeAws_ec2DatetimeOffsetsCommand } from "../protocols/Aws_ec2";

export interface DatetimeOffsetsCommandInput {}
export interface DatetimeOffsetsCommandOutput extends DatetimeOffsetsOutput, __MetadataBearer {}

export class DatetimeOffsetsCommand extends $Command<
DatetimeOffsetsCommandInput,
DatetimeOffsetsCommandOutput,
EC2ProtocolClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

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

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

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

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

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

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

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions private/aws-protocoltests-ec2/src/commands/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// smithy-typescript generated code
export * from "./DatetimeOffsetsCommand";
export * from "./EmptyInputAndEmptyOutputCommand";
export * from "./EndpointOperationCommand";
export * from "./EndpointWithHostLabelOperationCommand";
Expand Down
11 changes: 11 additions & 0 deletions private/aws-protocoltests-ec2/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { ExceptionOptionType as __ExceptionOptionType } from "@aws-sdk/smithy-cl

import { EC2ProtocolServiceException as __BaseException } from "./EC2ProtocolServiceException";

export interface DatetimeOffsetsOutput {
datetime?: Date;
}

/**
* @internal
*/
export const DatetimeOffsetsOutputFilterSensitiveLog = (obj: DatetimeOffsetsOutput): any => ({
...obj,
});

export interface EmptyInputAndEmptyOutputInput {}

/**
Expand Down
61 changes: 61 additions & 0 deletions private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
import { XMLParser } from "fast-xml-parser";
import { v4 as generateIdempotencyToken } from "uuid";

import { DatetimeOffsetsCommandInput, DatetimeOffsetsCommandOutput } from "../commands/DatetimeOffsetsCommand";
import {
EmptyInputAndEmptyOutputCommandInput,
EmptyInputAndEmptyOutputCommandOutput,
Expand Down Expand Up @@ -76,6 +77,7 @@ import { EC2ProtocolServiceException as __BaseException } from "../models/EC2Pro
import {
ComplexError,
ComplexNestedErrorData,
DatetimeOffsetsOutput,
EmptyInputAndEmptyOutputInput,
EmptyInputAndEmptyOutputOutput,
FooEnum,
Expand Down Expand Up @@ -107,6 +109,20 @@ import {
XmlTimestampsOutput,
} from "../models/models_0";

export const serializeAws_ec2DatetimeOffsetsCommand = async (
input: DatetimeOffsetsCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> => {
const headers: __HeaderBag = {
"content-type": "application/x-www-form-urlencoded",
};
const body = buildFormUrlencodedString({
Action: "DatetimeOffsets",
Version: "2020-01-08",
});
return buildHttpRpcRequest(context, headers, "/", undefined, body);
};

export const serializeAws_ec2EmptyInputAndEmptyOutputCommand = async (
input: EmptyInputAndEmptyOutputCommandInput,
context: __SerdeContext
Expand Down Expand Up @@ -447,6 +463,41 @@ export const serializeAws_ec2XmlTimestampsCommand = async (
return buildHttpRpcRequest(context, headers, "/", undefined, body);
};

export const deserializeAws_ec2DatetimeOffsetsCommand = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<DatetimeOffsetsCommandOutput> => {
if (output.statusCode >= 300) {
return deserializeAws_ec2DatetimeOffsetsCommandError(output, context);
}
const data: any = await parseBody(output.body, context);
let contents: any = {};
contents = deserializeAws_ec2DatetimeOffsetsOutput(data, context);
const response: DatetimeOffsetsCommandOutput = {
$metadata: deserializeMetadata(output),
...contents,
};
return Promise.resolve(response);
};

const deserializeAws_ec2DatetimeOffsetsCommandError = async (
output: __HttpResponse,
context: __SerdeContext
): Promise<DatetimeOffsetsCommandOutput> => {
const parsedOutput: any = {
...output,
body: await parseErrorBody(output.body, context),
};
const errorCode = loadEc2ErrorCode(output, parsedOutput.body);
const parsedBody = parsedOutput.body;
throwDefaultError({
output,
parsedBody: parsedBody.Errors.Error,
exceptionCtor: __BaseException,
errorCode,
});
};

export const deserializeAws_ec2EmptyInputAndEmptyOutputCommand = async (
output: __HttpResponse,
context: __SerdeContext
Expand Down Expand Up @@ -1481,6 +1532,16 @@ const deserializeAws_ec2ComplexNestedErrorData = (output: any, context: __SerdeC
return contents;
};

const deserializeAws_ec2DatetimeOffsetsOutput = (output: any, context: __SerdeContext): DatetimeOffsetsOutput => {
const contents: any = {
datetime: undefined,
};
if (output["datetime"] !== undefined) {
contents.datetime = __expectNonNull(__parseRfc3339DateTimeWithOffset(output["datetime"]));
}
return contents;
};

const deserializeAws_ec2EmptyInputAndEmptyOutputOutput = (
output: any,
context: __SerdeContext
Expand Down
Loading

0 comments on commit caee754

Please sign in to comment.