Skip to content

Commit

Permalink
feat(client-emr-containers): This release adds GetManagedEndpointSess…
Browse files Browse the repository at this point in the history
…ionCredentials, a new API that allows customers to generate an auth token to connect to a managed endpoint, enabling features such as self-hosted Jupyter notebooks for EMR on EKS.
  • Loading branch information
awstools committed Apr 27, 2023
1 parent ad22454 commit ab0a6d0
Show file tree
Hide file tree
Showing 10 changed files with 1,010 additions and 272 deletions.
8 changes: 8 additions & 0 deletions clients/client-emr-containers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,14 @@ DescribeVirtualCluster

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/classes/describevirtualclustercommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/interfaces/describevirtualclustercommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/interfaces/describevirtualclustercommandoutput.html)

</details>
<details>
<summary>
GetManagedEndpointSessionCredentials
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/classes/getmanagedendpointsessioncredentialscommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/interfaces/getmanagedendpointsessioncredentialscommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-emr-containers/interfaces/getmanagedendpointsessioncredentialscommandoutput.html)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-emr-containers/src/EMRContainers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ import {
DescribeVirtualClusterCommandInput,
DescribeVirtualClusterCommandOutput,
} from "./commands/DescribeVirtualClusterCommand";
import {
GetManagedEndpointSessionCredentialsCommand,
GetManagedEndpointSessionCredentialsCommandInput,
GetManagedEndpointSessionCredentialsCommandOutput,
} from "./commands/GetManagedEndpointSessionCredentialsCommand";
import { ListJobRunsCommand, ListJobRunsCommandInput, ListJobRunsCommandOutput } from "./commands/ListJobRunsCommand";
import {
ListJobTemplatesCommand,
Expand Down Expand Up @@ -99,6 +104,7 @@ const commands = {
DescribeJobTemplateCommand,
DescribeManagedEndpointCommand,
DescribeVirtualClusterCommand,
GetManagedEndpointSessionCredentialsCommand,
ListJobRunsCommand,
ListJobTemplatesCommand,
ListManagedEndpointsCommand,
Expand Down Expand Up @@ -288,6 +294,23 @@ export interface EMRContainers {
cb: (err: any, data?: DescribeVirtualClusterCommandOutput) => void
): void;

/**
* @see {@link GetManagedEndpointSessionCredentialsCommand}
*/
getManagedEndpointSessionCredentials(
args: GetManagedEndpointSessionCredentialsCommandInput,
options?: __HttpHandlerOptions
): Promise<GetManagedEndpointSessionCredentialsCommandOutput>;
getManagedEndpointSessionCredentials(
args: GetManagedEndpointSessionCredentialsCommandInput,
cb: (err: any, data?: GetManagedEndpointSessionCredentialsCommandOutput) => void
): void;
getManagedEndpointSessionCredentials(
args: GetManagedEndpointSessionCredentialsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetManagedEndpointSessionCredentialsCommandOutput) => void
): void;

/**
* @see {@link ListJobRunsCommand}
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-emr-containers/src/EMRContainersClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ import {
DescribeVirtualClusterCommandInput,
DescribeVirtualClusterCommandOutput,
} from "./commands/DescribeVirtualClusterCommand";
import {
GetManagedEndpointSessionCredentialsCommandInput,
GetManagedEndpointSessionCredentialsCommandOutput,
} from "./commands/GetManagedEndpointSessionCredentialsCommand";
import { ListJobRunsCommandInput, ListJobRunsCommandOutput } from "./commands/ListJobRunsCommand";
import { ListJobTemplatesCommandInput, ListJobTemplatesCommandOutput } from "./commands/ListJobTemplatesCommand";
import {
Expand Down Expand Up @@ -121,6 +125,7 @@ export type ServiceInputTypes =
| DescribeJobTemplateCommandInput
| DescribeManagedEndpointCommandInput
| DescribeVirtualClusterCommandInput
| GetManagedEndpointSessionCredentialsCommandInput
| ListJobRunsCommandInput
| ListJobTemplatesCommandInput
| ListManagedEndpointsCommandInput
Expand All @@ -145,6 +150,7 @@ export type ServiceOutputTypes =
| DescribeJobTemplateCommandOutput
| DescribeManagedEndpointCommandOutput
| DescribeVirtualClusterCommandOutput
| GetManagedEndpointSessionCredentialsCommandOutput
| ListJobRunsCommandOutput
| ListJobTemplatesCommandOutput
| ListManagedEndpointsCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
// 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 { EMRContainersClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../EMRContainersClient";
import {
GetManagedEndpointSessionCredentialsRequest,
GetManagedEndpointSessionCredentialsResponse,
GetManagedEndpointSessionCredentialsResponseFilterSensitiveLog,
} from "../models/models_0";
import {
de_GetManagedEndpointSessionCredentialsCommand,
se_GetManagedEndpointSessionCredentialsCommand,
} from "../protocols/Aws_restJson1";

/**
* @public
*
* The input for {@link GetManagedEndpointSessionCredentialsCommand}.
*/
export interface GetManagedEndpointSessionCredentialsCommandInput extends GetManagedEndpointSessionCredentialsRequest {}
/**
* @public
*
* The output of {@link GetManagedEndpointSessionCredentialsCommand}.
*/
export interface GetManagedEndpointSessionCredentialsCommandOutput
extends GetManagedEndpointSessionCredentialsResponse,
__MetadataBearer {}

/**
* @public
* <p>Generate a session token to connect to a managed endpoint. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { EMRContainersClient, GetManagedEndpointSessionCredentialsCommand } from "@aws-sdk/client-emr-containers"; // ES Modules import
* // const { EMRContainersClient, GetManagedEndpointSessionCredentialsCommand } = require("@aws-sdk/client-emr-containers"); // CommonJS import
* const client = new EMRContainersClient(config);
* const input = { // GetManagedEndpointSessionCredentialsRequest
* endpointIdentifier: "STRING_VALUE", // required
* virtualClusterIdentifier: "STRING_VALUE", // required
* executionRoleArn: "STRING_VALUE", // required
* credentialType: "STRING_VALUE", // required
* durationInSeconds: Number("int"),
* logContext: "STRING_VALUE",
* clientToken: "STRING_VALUE",
* };
* const command = new GetManagedEndpointSessionCredentialsCommand(input);
* const response = await client.send(command);
* ```
*
* @param GetManagedEndpointSessionCredentialsCommandInput - {@link GetManagedEndpointSessionCredentialsCommandInput}
* @returns {@link GetManagedEndpointSessionCredentialsCommandOutput}
* @see {@link GetManagedEndpointSessionCredentialsCommandInput} for command's `input` shape.
* @see {@link GetManagedEndpointSessionCredentialsCommandOutput} for command's `response` shape.
* @see {@link EMRContainersClientResolvedConfig | config} for EMRContainersClient's `config` shape.
*
* @throws {@link InternalServerException} (server fault)
* <p>This is an internal server exception.</p>
*
* @throws {@link RequestThrottledException} (client fault)
* <p>The request throttled.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource was not found.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>There are invalid parameters in the client request.</p>
*
*
*/
export class GetManagedEndpointSessionCredentialsCommand extends $Command<
GetManagedEndpointSessionCredentialsCommandInput,
GetManagedEndpointSessionCredentialsCommandOutput,
EMRContainersClientResolvedConfig
> {
// 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" },
};
}

/**
* @public
*/
constructor(readonly input: GetManagedEndpointSessionCredentialsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: EMRContainersClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetManagedEndpointSessionCredentialsCommandInput, GetManagedEndpointSessionCredentialsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(
getEndpointPlugin(configuration, GetManagedEndpointSessionCredentialsCommand.getEndpointParameterInstructions())
);

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

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

/**
* @internal
*/
private serialize(
input: GetManagedEndpointSessionCredentialsCommandInput,
context: __SerdeContext
): Promise<__HttpRequest> {
return se_GetManagedEndpointSessionCredentialsCommand(input, context);
}

/**
* @internal
*/
private deserialize(
output: __HttpResponse,
context: __SerdeContext
): Promise<GetManagedEndpointSessionCredentialsCommandOutput> {
return de_GetManagedEndpointSessionCredentialsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-emr-containers/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from "./DescribeJobRunCommand";
export * from "./DescribeJobTemplateCommand";
export * from "./DescribeManagedEndpointCommand";
export * from "./DescribeVirtualClusterCommand";
export * from "./GetManagedEndpointSessionCredentialsCommand";
export * from "./ListJobRunsCommand";
export * from "./ListJobTemplatesCommand";
export * from "./ListManagedEndpointsCommand";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const resolveClientEndpointParameters = <T>(
};

export interface EndpointParameters extends __EndpointParameters {
Region: string;
Region?: string;
UseDualStack?: boolean;
UseFIPS?: boolean;
Endpoint?: string;
Expand Down
39 changes: 20 additions & 19 deletions clients/client-emr-containers/src/endpoint/ruleset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ import { RuleSetObject } from "@aws-sdk/util-endpoints";
or see "smithy.rules#endpointRuleSet"
in codegen/sdk-codegen/aws-models/emr-containers.json */

const q="fn",
r="argv",
s="ref";
const a=true,
b=false,
c="String",
d="PartitionResult",
e="tree",
f="error",
g="endpoint",
h={"required":true,"default":false,"type":"Boolean"},
i={[s]:"Endpoint"},
j={[q]:"booleanEquals",[r]:[{[s]:"UseFIPS"},true]},
k={[q]:"booleanEquals",[r]:[{[s]:"UseDualStack"},true]},
l={},
m={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsFIPS"]}]},
n={[q]:"booleanEquals",[r]:[true,{[q]:"getAttr",[r]:[{[s]:d},"supportsDualStack"]}]},
const q="required",
r="fn",
s="argv",
t="ref";
const a="isSet",
b="tree",
c="error",
d="endpoint",
e="PartitionResult",
f={[q]:false,"type":"String"},
g={[q]:true,"default":false,"type":"Boolean"},
h={[t]:"Endpoint"},
i={[r]:"booleanEquals",[s]:[{[t]:"UseFIPS"},true]},
j={[r]:"booleanEquals",[s]:[{[t]:"UseDualStack"},true]},
k={},
l={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsFIPS"]}]},
m={[r]:"booleanEquals",[s]:[true,{[r]:"getAttr",[s]:[{[t]:e},"supportsDualStack"]}]},
n=[i],
o=[j],
p=[k];
const _data={version:"1.0",parameters:{Region:{required:a,type:c},UseDualStack:h,UseFIPS:h,Endpoint:{required:b,type:c}},rules:[{conditions:[{[q]:"aws.partition",[r]:[{[s]:"Region"}],assign:d}],type:e,rules:[{conditions:[{[q]:"isSet",[r]:[i]}],type:e,rules:[{conditions:o,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:f},{type:e,rules:[{conditions:p,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:f},{endpoint:{url:i,properties:l,headers:l},type:g}]}]},{conditions:[j,k],type:e,rules:[{conditions:[m,n],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://emr-containers-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:f}]},{conditions:o,type:e,rules:[{conditions:[m],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://emr-containers-fips.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:f}]},{conditions:p,type:e,rules:[{conditions:[n],type:e,rules:[{type:e,rules:[{endpoint:{url:"https://emr-containers.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:l,headers:l},type:g}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:f}]},{type:e,rules:[{endpoint:{url:"https://emr-containers.{Region}.{PartitionResult#dnsSuffix}",properties:l,headers:l},type:g}]}]}]};
p=[{[t]:"Region"}];
const _data={version:"1.0",parameters:{Region:f,UseDualStack:g,UseFIPS:g,Endpoint:f},rules:[{conditions:[{[r]:a,[s]:[h]}],type:b,rules:[{conditions:n,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:c},{type:b,rules:[{conditions:o,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:c},{endpoint:{url:h,properties:k,headers:k},type:d}]}]},{type:b,rules:[{conditions:[{[r]:a,[s]:p}],type:b,rules:[{conditions:[{[r]:"aws.partition",[s]:p,assign:e}],type:b,rules:[{conditions:[i,j],type:b,rules:[{conditions:[l,m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://emr-containers-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:c}]},{conditions:n,type:b,rules:[{conditions:[l],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://emr-containers-fips.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"FIPS is enabled but this partition does not support FIPS",type:c}]},{conditions:o,type:b,rules:[{conditions:[m],type:b,rules:[{type:b,rules:[{endpoint:{url:"https://emr-containers.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:k,headers:k},type:d}]}]},{error:"DualStack is enabled but this partition does not support DualStack",type:c}]},{type:b,rules:[{endpoint:{url:"https://emr-containers.{Region}.{PartitionResult#dnsSuffix}",properties:k,headers:k},type:d}]}]}]},{error:"Invalid Configuration: Missing Region",type:c}]}]};
export const ruleSet: RuleSetObject = _data;
Loading

0 comments on commit ab0a6d0

Please sign in to comment.