Skip to content

Commit

Permalink
feat(client-servicediscovery): AWS Cloud Map now supports service-lev…
Browse files Browse the repository at this point in the history
…el attributes, allowing you to associate custom metadata directly with services. These attributes can be retrieved, updated, and deleted using the new GetServiceAttributes, UpdateServiceAttributes, and DeleteServiceAttributes API calls.
  • Loading branch information
awstools committed Dec 13, 2024
1 parent b525bd5 commit c908c6c
Show file tree
Hide file tree
Showing 11 changed files with 983 additions and 11 deletions.
24 changes: 24 additions & 0 deletions clients/client-servicediscovery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ DeleteService

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/DeleteServiceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/DeleteServiceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/DeleteServiceCommandOutput/)

</details>
<details>
<summary>
DeleteServiceAttributes
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/DeleteServiceAttributesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/DeleteServiceAttributesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/DeleteServiceAttributesCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -320,6 +328,14 @@ GetService

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/GetServiceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/GetServiceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/GetServiceCommandOutput/)

</details>
<details>
<summary>
GetServiceAttributes
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/GetServiceAttributesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/GetServiceAttributesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/GetServiceAttributesCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -425,3 +441,11 @@ UpdateService
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/UpdateServiceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/UpdateServiceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/UpdateServiceCommandOutput/)

</details>
<details>
<summary>
UpdateServiceAttributes
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/servicediscovery/command/UpdateServiceAttributesCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/UpdateServiceAttributesCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-servicediscovery/Interface/UpdateServiceAttributesCommandOutput/)

</details>
69 changes: 69 additions & 0 deletions clients/client-servicediscovery/src/ServiceDiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ import {
DeleteNamespaceCommandInput,
DeleteNamespaceCommandOutput,
} from "./commands/DeleteNamespaceCommand";
import {
DeleteServiceAttributesCommand,
DeleteServiceAttributesCommandInput,
DeleteServiceAttributesCommandOutput,
} from "./commands/DeleteServiceAttributesCommand";
import {
DeleteServiceCommand,
DeleteServiceCommandInput,
Expand Down Expand Up @@ -63,6 +68,11 @@ import {
GetOperationCommandInput,
GetOperationCommandOutput,
} from "./commands/GetOperationCommand";
import {
GetServiceAttributesCommand,
GetServiceAttributesCommandInput,
GetServiceAttributesCommandOutput,
} from "./commands/GetServiceAttributesCommand";
import { GetServiceCommand, GetServiceCommandInput, GetServiceCommandOutput } from "./commands/GetServiceCommand";
import {
ListInstancesCommand,
Expand Down Expand Up @@ -120,6 +130,11 @@ import {
UpdatePublicDnsNamespaceCommandInput,
UpdatePublicDnsNamespaceCommandOutput,
} from "./commands/UpdatePublicDnsNamespaceCommand";
import {
UpdateServiceAttributesCommand,
UpdateServiceAttributesCommandInput,
UpdateServiceAttributesCommandOutput,
} from "./commands/UpdateServiceAttributesCommand";
import {
UpdateServiceCommand,
UpdateServiceCommandInput,
Expand All @@ -134,6 +149,7 @@ const commands = {
CreateServiceCommand,
DeleteNamespaceCommand,
DeleteServiceCommand,
DeleteServiceAttributesCommand,
DeregisterInstanceCommand,
DiscoverInstancesCommand,
DiscoverInstancesRevisionCommand,
Expand All @@ -142,6 +158,7 @@ const commands = {
GetNamespaceCommand,
GetOperationCommand,
GetServiceCommand,
GetServiceAttributesCommand,
ListInstancesCommand,
ListNamespacesCommand,
ListOperationsCommand,
Expand All @@ -155,6 +172,7 @@ const commands = {
UpdatePrivateDnsNamespaceCommand,
UpdatePublicDnsNamespaceCommand,
UpdateServiceCommand,
UpdateServiceAttributesCommand,
};

export interface ServiceDiscovery {
Expand Down Expand Up @@ -245,6 +263,23 @@ export interface ServiceDiscovery {
cb: (err: any, data?: DeleteServiceCommandOutput) => void
): void;

/**
* @see {@link DeleteServiceAttributesCommand}
*/
deleteServiceAttributes(
args: DeleteServiceAttributesCommandInput,
options?: __HttpHandlerOptions
): Promise<DeleteServiceAttributesCommandOutput>;
deleteServiceAttributes(
args: DeleteServiceAttributesCommandInput,
cb: (err: any, data?: DeleteServiceAttributesCommandOutput) => void
): void;
deleteServiceAttributes(
args: DeleteServiceAttributesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DeleteServiceAttributesCommandOutput) => void
): void;

/**
* @see {@link DeregisterInstanceCommand}
*/
Expand Down Expand Up @@ -357,6 +392,23 @@ export interface ServiceDiscovery {
cb: (err: any, data?: GetServiceCommandOutput) => void
): void;

/**
* @see {@link GetServiceAttributesCommand}
*/
getServiceAttributes(
args: GetServiceAttributesCommandInput,
options?: __HttpHandlerOptions
): Promise<GetServiceAttributesCommandOutput>;
getServiceAttributes(
args: GetServiceAttributesCommandInput,
cb: (err: any, data?: GetServiceAttributesCommandOutput) => void
): void;
getServiceAttributes(
args: GetServiceAttributesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetServiceAttributesCommandOutput) => void
): void;

/**
* @see {@link ListInstancesCommand}
*/
Expand Down Expand Up @@ -544,6 +596,23 @@ export interface ServiceDiscovery {
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateServiceCommandOutput) => void
): void;

/**
* @see {@link UpdateServiceAttributesCommand}
*/
updateServiceAttributes(
args: UpdateServiceAttributesCommandInput,
options?: __HttpHandlerOptions
): Promise<UpdateServiceAttributesCommandOutput>;
updateServiceAttributes(
args: UpdateServiceAttributesCommandInput,
cb: (err: any, data?: UpdateServiceAttributesCommandOutput) => void
): void;
updateServiceAttributes(
args: UpdateServiceAttributesCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateServiceAttributesCommandOutput) => void
): void;
}

/**
Expand Down
18 changes: 18 additions & 0 deletions clients/client-servicediscovery/src/ServiceDiscoveryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ import {
} from "./commands/CreatePublicDnsNamespaceCommand";
import { CreateServiceCommandInput, CreateServiceCommandOutput } from "./commands/CreateServiceCommand";
import { DeleteNamespaceCommandInput, DeleteNamespaceCommandOutput } from "./commands/DeleteNamespaceCommand";
import {
DeleteServiceAttributesCommandInput,
DeleteServiceAttributesCommandOutput,
} from "./commands/DeleteServiceAttributesCommand";
import { DeleteServiceCommandInput, DeleteServiceCommandOutput } from "./commands/DeleteServiceCommand";
import { DeregisterInstanceCommandInput, DeregisterInstanceCommandOutput } from "./commands/DeregisterInstanceCommand";
import { DiscoverInstancesCommandInput, DiscoverInstancesCommandOutput } from "./commands/DiscoverInstancesCommand";
Expand All @@ -81,6 +85,10 @@ import {
} from "./commands/GetInstancesHealthStatusCommand";
import { GetNamespaceCommandInput, GetNamespaceCommandOutput } from "./commands/GetNamespaceCommand";
import { GetOperationCommandInput, GetOperationCommandOutput } from "./commands/GetOperationCommand";
import {
GetServiceAttributesCommandInput,
GetServiceAttributesCommandOutput,
} from "./commands/GetServiceAttributesCommand";
import { GetServiceCommandInput, GetServiceCommandOutput } from "./commands/GetServiceCommand";
import { ListInstancesCommandInput, ListInstancesCommandOutput } from "./commands/ListInstancesCommand";
import { ListNamespacesCommandInput, ListNamespacesCommandOutput } from "./commands/ListNamespacesCommand";
Expand Down Expand Up @@ -109,6 +117,10 @@ import {
UpdatePublicDnsNamespaceCommandInput,
UpdatePublicDnsNamespaceCommandOutput,
} from "./commands/UpdatePublicDnsNamespaceCommand";
import {
UpdateServiceAttributesCommandInput,
UpdateServiceAttributesCommandOutput,
} from "./commands/UpdateServiceAttributesCommand";
import { UpdateServiceCommandInput, UpdateServiceCommandOutput } from "./commands/UpdateServiceCommand";
import {
ClientInputEndpointParameters,
Expand All @@ -130,6 +142,7 @@ export type ServiceInputTypes =
| CreatePublicDnsNamespaceCommandInput
| CreateServiceCommandInput
| DeleteNamespaceCommandInput
| DeleteServiceAttributesCommandInput
| DeleteServiceCommandInput
| DeregisterInstanceCommandInput
| DiscoverInstancesCommandInput
Expand All @@ -138,6 +151,7 @@ export type ServiceInputTypes =
| GetInstancesHealthStatusCommandInput
| GetNamespaceCommandInput
| GetOperationCommandInput
| GetServiceAttributesCommandInput
| GetServiceCommandInput
| ListInstancesCommandInput
| ListNamespacesCommandInput
Expand All @@ -151,6 +165,7 @@ export type ServiceInputTypes =
| UpdateInstanceCustomHealthStatusCommandInput
| UpdatePrivateDnsNamespaceCommandInput
| UpdatePublicDnsNamespaceCommandInput
| UpdateServiceAttributesCommandInput
| UpdateServiceCommandInput;

/**
Expand All @@ -162,6 +177,7 @@ export type ServiceOutputTypes =
| CreatePublicDnsNamespaceCommandOutput
| CreateServiceCommandOutput
| DeleteNamespaceCommandOutput
| DeleteServiceAttributesCommandOutput
| DeleteServiceCommandOutput
| DeregisterInstanceCommandOutput
| DiscoverInstancesCommandOutput
Expand All @@ -170,6 +186,7 @@ export type ServiceOutputTypes =
| GetInstancesHealthStatusCommandOutput
| GetNamespaceCommandOutput
| GetOperationCommandOutput
| GetServiceAttributesCommandOutput
| GetServiceCommandOutput
| ListInstancesCommandOutput
| ListNamespacesCommandOutput
Expand All @@ -183,6 +200,7 @@ export type ServiceOutputTypes =
| UpdateInstanceCustomHealthStatusCommandOutput
| UpdatePrivateDnsNamespaceCommandOutput
| UpdatePublicDnsNamespaceCommandOutput
| UpdateServiceAttributesCommandOutput
| UpdateServiceCommandOutput;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { commonParams } from "../endpoint/EndpointParameters";
import { DeleteServiceAttributesRequest, DeleteServiceAttributesResponse } from "../models/models_0";
import { de_DeleteServiceAttributesCommand, se_DeleteServiceAttributesCommand } from "../protocols/Aws_json1_1";
import { ServiceDiscoveryClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ServiceDiscoveryClient";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link DeleteServiceAttributesCommand}.
*/
export interface DeleteServiceAttributesCommandInput extends DeleteServiceAttributesRequest {}
/**
* @public
*
* The output of {@link DeleteServiceAttributesCommand}.
*/
export interface DeleteServiceAttributesCommandOutput extends DeleteServiceAttributesResponse, __MetadataBearer {}

/**
* <p>Deletes specific attributes associated with a service.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { ServiceDiscoveryClient, DeleteServiceAttributesCommand } from "@aws-sdk/client-servicediscovery"; // ES Modules import
* // const { ServiceDiscoveryClient, DeleteServiceAttributesCommand } = require("@aws-sdk/client-servicediscovery"); // CommonJS import
* const client = new ServiceDiscoveryClient(config);
* const input = { // DeleteServiceAttributesRequest
* ServiceId: "STRING_VALUE", // required
* Attributes: [ // ServiceAttributeKeyList // required
* "STRING_VALUE",
* ],
* };
* const command = new DeleteServiceAttributesCommand(input);
* const response = await client.send(command);
* // {};
*
* ```
*
* @param DeleteServiceAttributesCommandInput - {@link DeleteServiceAttributesCommandInput}
* @returns {@link DeleteServiceAttributesCommandOutput}
* @see {@link DeleteServiceAttributesCommandInput} for command's `input` shape.
* @see {@link DeleteServiceAttributesCommandOutput} for command's `response` shape.
* @see {@link ServiceDiscoveryClientResolvedConfig | config} for ServiceDiscoveryClient's `config` shape.
*
* @throws {@link InvalidInput} (client fault)
* <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value
* might be outside the allowed range, or a string value might exceed length constraints.</p>
*
* @throws {@link ServiceNotFound} (client fault)
* <p>No service exists with the specified ID.</p>
*
* @throws {@link ServiceDiscoveryServiceException}
* <p>Base exception class for all service exceptions from ServiceDiscovery service.</p>
*
* @public
*/
export class DeleteServiceAttributesCommand extends $Command
.classBuilder<
DeleteServiceAttributesCommandInput,
DeleteServiceAttributesCommandOutput,
ServiceDiscoveryClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep(commonParams)
.m(function (this: any, Command: any, cs: any, config: ServiceDiscoveryClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("Route53AutoNaming_v20170314", "DeleteServiceAttributes", {})
.n("ServiceDiscoveryClient", "DeleteServiceAttributesCommand")
.f(void 0, void 0)
.ser(se_DeleteServiceAttributesCommand)
.de(de_DeleteServiceAttributesCommand)
.build() {
/** @internal type navigation helper, not in runtime. */
protected declare static __types: {
api: {
input: DeleteServiceAttributesRequest;
output: {};
};
sdk: {
input: DeleteServiceAttributesCommandInput;
output: DeleteServiceAttributesCommandOutput;
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DeleteServiceCommandInput extends DeleteServiceRequest {}
export interface DeleteServiceCommandOutput extends DeleteServiceResponse, __MetadataBearer {}

/**
* <p>Deletes a specified service. If the service still contains one or more registered instances, the request
* <p>Deletes a specified service and all associated service attributes. If the service still contains one or more registered instances, the request
* fails.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
Expand Down
Loading

0 comments on commit c908c6c

Please sign in to comment.