From 9695325a17f5ea1ff7dc96ec1094765b93c2dcb3 Mon Sep 17 00:00:00 2001 From: awstools Date: Thu, 10 Oct 2024 18:17:37 +0000 Subject: [PATCH] feat(client-iotfleetwise): Refine campaign related API validations --- .../src/commands/CreateCampaignCommand.ts | 8 ++- .../src/commands/GetCampaignCommand.ts | 4 +- .../src/commands/UpdateCampaignCommand.ts | 8 ++- .../src/models/models_0.ts | 56 ++++++++++++++++++- .../sdk-codegen/aws-models/iotfleetwise.json | 54 +++++++++++++----- 5 files changed, 108 insertions(+), 22 deletions(-) diff --git a/clients/client-iotfleetwise/src/commands/CreateCampaignCommand.ts b/clients/client-iotfleetwise/src/commands/CreateCampaignCommand.ts index cce2d05a7f09..17d12ba6a14c 100644 --- a/clients/client-iotfleetwise/src/commands/CreateCampaignCommand.ts +++ b/clients/client-iotfleetwise/src/commands/CreateCampaignCommand.ts @@ -6,7 +6,11 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { commonParams } from "../endpoint/EndpointParameters"; import { IoTFleetWiseClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTFleetWiseClient"; -import { CreateCampaignRequest, CreateCampaignResponse } from "../models/models_0"; +import { + CreateCampaignRequest, + CreateCampaignRequestFilterSensitiveLog, + CreateCampaignResponse, +} from "../models/models_0"; import { de_CreateCampaignCommand, se_CreateCampaignCommand } from "../protocols/Aws_json1_0"; /** @@ -153,7 +157,7 @@ export class CreateCampaignCommand extends $Command }) .s("IoTAutobahnControlPlane", "CreateCampaign", {}) .n("IoTFleetWiseClient", "CreateCampaignCommand") - .f(void 0, void 0) + .f(CreateCampaignRequestFilterSensitiveLog, void 0) .ser(se_CreateCampaignCommand) .de(de_CreateCampaignCommand) .build() { diff --git a/clients/client-iotfleetwise/src/commands/GetCampaignCommand.ts b/clients/client-iotfleetwise/src/commands/GetCampaignCommand.ts index e4cfdf7c3cd9..e802f766c45c 100644 --- a/clients/client-iotfleetwise/src/commands/GetCampaignCommand.ts +++ b/clients/client-iotfleetwise/src/commands/GetCampaignCommand.ts @@ -6,7 +6,7 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { commonParams } from "../endpoint/EndpointParameters"; import { IoTFleetWiseClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTFleetWiseClient"; -import { GetCampaignRequest, GetCampaignResponse } from "../models/models_0"; +import { GetCampaignRequest, GetCampaignResponse, GetCampaignResponseFilterSensitiveLog } from "../models/models_0"; import { de_GetCampaignCommand, se_GetCampaignCommand } from "../protocols/Aws_json1_0"; /** @@ -138,7 +138,7 @@ export class GetCampaignCommand extends $Command }) .s("IoTAutobahnControlPlane", "GetCampaign", {}) .n("IoTFleetWiseClient", "GetCampaignCommand") - .f(void 0, void 0) + .f(void 0, GetCampaignResponseFilterSensitiveLog) .ser(se_GetCampaignCommand) .de(de_GetCampaignCommand) .build() { diff --git a/clients/client-iotfleetwise/src/commands/UpdateCampaignCommand.ts b/clients/client-iotfleetwise/src/commands/UpdateCampaignCommand.ts index fc2aade1bb21..f2c88e6771a0 100644 --- a/clients/client-iotfleetwise/src/commands/UpdateCampaignCommand.ts +++ b/clients/client-iotfleetwise/src/commands/UpdateCampaignCommand.ts @@ -6,7 +6,11 @@ import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { commonParams } from "../endpoint/EndpointParameters"; import { IoTFleetWiseClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../IoTFleetWiseClient"; -import { UpdateCampaignRequest, UpdateCampaignResponse } from "../models/models_0"; +import { + UpdateCampaignRequest, + UpdateCampaignRequestFilterSensitiveLog, + UpdateCampaignResponse, +} from "../models/models_0"; import { de_UpdateCampaignCommand, se_UpdateCampaignCommand } from "../protocols/Aws_json1_0"; /** @@ -100,7 +104,7 @@ export class UpdateCampaignCommand extends $Command }) .s("IoTAutobahnControlPlane", "UpdateCampaign", {}) .n("IoTFleetWiseClient", "UpdateCampaignCommand") - .f(void 0, void 0) + .f(UpdateCampaignRequestFilterSensitiveLog, void 0) .ser(se_UpdateCampaignCommand) .de(de_UpdateCampaignCommand) .build() { diff --git a/clients/client-iotfleetwise/src/models/models_0.ts b/clients/client-iotfleetwise/src/models/models_0.ts index b46c07bbaa32..dd9450b27e4a 100644 --- a/clients/client-iotfleetwise/src/models/models_0.ts +++ b/clients/client-iotfleetwise/src/models/models_0.ts @@ -1,5 +1,5 @@ // smithy-typescript generated code -import { ExceptionOptionType as __ExceptionOptionType } from "@smithy/smithy-client"; +import { ExceptionOptionType as __ExceptionOptionType, SENSITIVE_STRING } from "@smithy/smithy-client"; import { IoTFleetWiseServiceException as __BaseException } from "./IoTFleetWiseServiceException"; @@ -1229,6 +1229,8 @@ export interface CreateCampaignRequest { compression?: Compression; /** + * @deprecated + * *

(Optional) A number indicating the priority of one campaign over another campaign for * a certain vehicle or fleet. A campaign with the lowest value is deployed to vehicles * before any other campaigns. If it's not specified, 0 is used.

@@ -5420,3 +5422,55 @@ export interface UpdateDecoderManifestRequest { */ status?: ManifestStatus; } + +/** + * @internal + */ +export const ConditionBasedCollectionSchemeFilterSensitiveLog = (obj: ConditionBasedCollectionScheme): any => ({ + ...obj, + ...(obj.expression && { expression: SENSITIVE_STRING }), +}); + +/** + * @internal + */ +export const CollectionSchemeFilterSensitiveLog = (obj: CollectionScheme): any => { + if (obj.timeBasedCollectionScheme !== undefined) return { timeBasedCollectionScheme: obj.timeBasedCollectionScheme }; + if (obj.conditionBasedCollectionScheme !== undefined) + return { + conditionBasedCollectionScheme: ConditionBasedCollectionSchemeFilterSensitiveLog( + obj.conditionBasedCollectionScheme + ), + }; + if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" }; +}; + +/** + * @internal + */ +export const CreateCampaignRequestFilterSensitiveLog = (obj: CreateCampaignRequest): any => ({ + ...obj, + ...(obj.signalsToCollect && { signalsToCollect: SENSITIVE_STRING }), + ...(obj.collectionScheme && { collectionScheme: CollectionSchemeFilterSensitiveLog(obj.collectionScheme) }), + ...(obj.dataExtraDimensions && { dataExtraDimensions: SENSITIVE_STRING }), + ...(obj.dataDestinationConfigs && { dataDestinationConfigs: obj.dataDestinationConfigs.map((item) => item) }), +}); + +/** + * @internal + */ +export const GetCampaignResponseFilterSensitiveLog = (obj: GetCampaignResponse): any => ({ + ...obj, + ...(obj.signalsToCollect && { signalsToCollect: SENSITIVE_STRING }), + ...(obj.collectionScheme && { collectionScheme: CollectionSchemeFilterSensitiveLog(obj.collectionScheme) }), + ...(obj.dataExtraDimensions && { dataExtraDimensions: SENSITIVE_STRING }), + ...(obj.dataDestinationConfigs && { dataDestinationConfigs: obj.dataDestinationConfigs.map((item) => item) }), +}); + +/** + * @internal + */ +export const UpdateCampaignRequestFilterSensitiveLog = (obj: UpdateCampaignRequest): any => ({ + ...obj, + ...(obj.dataExtraDimensions && { dataExtraDimensions: SENSITIVE_STRING }), +}); diff --git a/codegen/sdk-codegen/aws-models/iotfleetwise.json b/codegen/sdk-codegen/aws-models/iotfleetwise.json index ef209e72864f..6b7b0162d093 100644 --- a/codegen/sdk-codegen/aws-models/iotfleetwise.json +++ b/codegen/sdk-codegen/aws-models/iotfleetwise.json @@ -102,7 +102,8 @@ "smithy.api#length": { "min": 1, "max": 1011 - } + }, + "smithy.api#pattern": "^arn:.*" } }, "com.amazonaws.iotfleetwise#AssociateVehicleFleet": { @@ -463,7 +464,7 @@ "type": "structure", "members": { "arn": { - "target": "com.amazonaws.iotfleetwise#arn", + "target": "com.amazonaws.iotfleetwise#campaignArn", "traits": { "smithy.api#documentation": "

The Amazon Resource Name (ARN) of a campaign.

" } @@ -897,6 +898,9 @@ "priority": { "target": "com.amazonaws.iotfleetwise#priority", "traits": { + "smithy.api#deprecated": { + "message": "priority is no longer used or needed as input" + }, "smithy.api#documentation": "

(Optional) A number indicating the priority of one campaign over another campaign for\n a certain vehicle or fleet. A campaign with the lowest value is deployed to vehicles\n before any other campaigns. If it's not specified, 0 is used.

\n

Default: 0\n

" } }, @@ -943,7 +947,7 @@ } }, "arn": { - "target": "com.amazonaws.iotfleetwise#arn", + "target": "com.amazonaws.iotfleetwise#campaignArn", "traits": { "smithy.api#documentation": "

The ARN of the created campaign.

" } @@ -1667,10 +1671,12 @@ "target": "com.amazonaws.iotfleetwise#NodePath" }, "traits": { + "aws.api#data": "content", "smithy.api#length": { "min": 0, "max": 5 - } + }, + "smithy.api#sensitive": {} } }, "com.amazonaws.iotfleetwise#DataFormat": { @@ -1868,7 +1874,7 @@ } }, "arn": { - "target": "com.amazonaws.iotfleetwise#arn", + "target": "com.amazonaws.iotfleetwise#campaignArn", "traits": { "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the deleted campaign.

\n \n

The ARN isn’t returned if a campaign doesn’t exist.

\n
" } @@ -2503,7 +2509,7 @@ } }, "arn": { - "target": "com.amazonaws.iotfleetwise#arn", + "target": "com.amazonaws.iotfleetwise#campaignArn", "traits": { "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the campaign.

" } @@ -4592,7 +4598,7 @@ } }, "status": { - "target": "com.amazonaws.iotfleetwise#status", + "target": "com.amazonaws.iotfleetwise#statusStr", "traits": { "smithy.api#documentation": "

Optional parameter to filter the results by the status of each created campaign in\n your account. The status can be one of: CREATING,\n WAITING_FOR_APPROVAL, RUNNING, or\n SUSPENDED.

", "smithy.api#httpQuery": "status" @@ -7290,10 +7296,12 @@ "target": "com.amazonaws.iotfleetwise#SignalInformation" }, "traits": { + "aws.api#data": "content", "smithy.api#length": { "min": 0, "max": 1000 - } + }, + "smithy.api#sensitive": {} } }, "com.amazonaws.iotfleetwise#SignalNodeType": { @@ -7983,7 +7991,7 @@ "type": "structure", "members": { "arn": { - "target": "com.amazonaws.iotfleetwise#arn", + "target": "com.amazonaws.iotfleetwise#campaignArn", "traits": { "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the campaign.

" } @@ -8829,7 +8837,7 @@ "type": "structure", "members": { "campaignName": { - "target": "com.amazonaws.iotfleetwise#string", + "target": "com.amazonaws.iotfleetwise#campaignName", "traits": { "smithy.api#documentation": "

The name of a campaign.

" } @@ -8962,6 +8970,12 @@ "target": "com.amazonaws.iotfleetwise#attributeValue" } }, + "com.amazonaws.iotfleetwise#campaignArn": { + "type": "string", + "traits": { + "smithy.api#pattern": "^arn:aws:iotfleetwise:[a-z0-9-]+:[0-9]{12}:campaign/[a-zA-Z\\d\\-_:]{1,100}$" + } + }, "com.amazonaws.iotfleetwise#campaignName": { "type": "string", "traits": { @@ -8983,7 +8997,7 @@ "traits": { "smithy.api#range": { "min": 10000, - "max": 60000 + "max": 86400000 } } }, @@ -9038,10 +9052,12 @@ "com.amazonaws.iotfleetwise#eventExpression": { "type": "string", "traits": { + "aws.api#data": "content", "smithy.api#length": { "min": 1, "max": 2048 - } + }, + "smithy.api#sensitive": {} } }, "com.amazonaws.iotfleetwise#fleetId": { @@ -9070,7 +9086,8 @@ "type": "integer", "traits": { "smithy.api#range": { - "min": 1 + "min": 1, + "max": 1 } } }, @@ -9188,8 +9205,15 @@ "target": "com.amazonaws.iotfleetwise#SignalCatalogSummary" } }, - "com.amazonaws.iotfleetwise#status": { - "type": "string" + "com.amazonaws.iotfleetwise#statusStr": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 7, + "max": 20 + }, + "smithy.api#pattern": "^[A-Z_]*$" + } }, "com.amazonaws.iotfleetwise#string": { "type": "string"