Skip to content

Commit

Permalink
feat(client-iotfleetwise): Refine campaign related API validations
Browse files Browse the repository at this point in the history
  • Loading branch information
awstools committed Oct 10, 2024
1 parent 88ca256 commit 9695325
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -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() {
Expand Down
56 changes: 55 additions & 1 deletion clients/client-iotfleetwise/src/models/models_0.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -1229,6 +1229,8 @@ export interface CreateCampaignRequest {
compression?: Compression;

/**
* @deprecated
*
* <p>(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, <code>0</code> is used. </p>
Expand Down Expand Up @@ -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 }),
});
54 changes: 39 additions & 15 deletions codegen/sdk-codegen/aws-models/iotfleetwise.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"smithy.api#length": {
"min": 1,
"max": 1011
}
},
"smithy.api#pattern": "^arn:.*"
}
},
"com.amazonaws.iotfleetwise#AssociateVehicleFleet": {
Expand Down Expand Up @@ -463,7 +464,7 @@
"type": "structure",
"members": {
"arn": {
"target": "com.amazonaws.iotfleetwise#arn",
"target": "com.amazonaws.iotfleetwise#campaignArn",
"traits": {
"smithy.api#documentation": "<p>The Amazon Resource Name (ARN) of a campaign.</p>"
}
Expand Down Expand Up @@ -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": "<p>(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, <code>0</code> is used. </p>\n <p>Default: <code>0</code>\n </p>"
}
},
Expand Down Expand Up @@ -943,7 +947,7 @@
}
},
"arn": {
"target": "com.amazonaws.iotfleetwise#arn",
"target": "com.amazonaws.iotfleetwise#campaignArn",
"traits": {
"smithy.api#documentation": "<p> The ARN of the created campaign. </p>"
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -1868,7 +1874,7 @@
}
},
"arn": {
"target": "com.amazonaws.iotfleetwise#arn",
"target": "com.amazonaws.iotfleetwise#campaignArn",
"traits": {
"smithy.api#documentation": "<p> The Amazon Resource Name (ARN) of the deleted campaign.</p>\n <note>\n <p>The ARN isn’t returned if a campaign doesn’t exist.</p>\n </note>"
}
Expand Down Expand Up @@ -2503,7 +2509,7 @@
}
},
"arn": {
"target": "com.amazonaws.iotfleetwise#arn",
"target": "com.amazonaws.iotfleetwise#campaignArn",
"traits": {
"smithy.api#documentation": "<p> The Amazon Resource Name (ARN) of the campaign. </p>"
}
Expand Down Expand Up @@ -4592,7 +4598,7 @@
}
},
"status": {
"target": "com.amazonaws.iotfleetwise#status",
"target": "com.amazonaws.iotfleetwise#statusStr",
"traits": {
"smithy.api#documentation": "<p>Optional parameter to filter the results by the status of each created campaign in\n your account. The status can be one of: <code>CREATING</code>,\n <code>WAITING_FOR_APPROVAL</code>, <code>RUNNING</code>, or\n <code>SUSPENDED</code>.</p>",
"smithy.api#httpQuery": "status"
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -7983,7 +7991,7 @@
"type": "structure",
"members": {
"arn": {
"target": "com.amazonaws.iotfleetwise#arn",
"target": "com.amazonaws.iotfleetwise#campaignArn",
"traits": {
"smithy.api#documentation": "<p> The Amazon Resource Name (ARN) of the campaign. </p>"
}
Expand Down Expand Up @@ -8829,7 +8837,7 @@
"type": "structure",
"members": {
"campaignName": {
"target": "com.amazonaws.iotfleetwise#string",
"target": "com.amazonaws.iotfleetwise#campaignName",
"traits": {
"smithy.api#documentation": "<p>The name of a campaign.</p>"
}
Expand Down Expand Up @@ -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": {
Expand All @@ -8983,7 +8997,7 @@
"traits": {
"smithy.api#range": {
"min": 10000,
"max": 60000
"max": 86400000
}
}
},
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -9070,7 +9086,8 @@
"type": "integer",
"traits": {
"smithy.api#range": {
"min": 1
"min": 1,
"max": 1
}
}
},
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 9695325

Please sign in to comment.