Skip to content

Commit

Permalink
fix(client-marketplace-entitlement-service): update model to fix expe…
Browse files Browse the repository at this point in the history
…ctUnion error (#4297)
  • Loading branch information
kuhe committed Dec 16, 2022
1 parent efdda44 commit eb661ce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,85 +44,30 @@ export interface GetEntitlementsRequest {
* <p>The EntitlementValue represents the amount of capacity that the customer is entitled to
* for the product.</p>
*/
export type EntitlementValue =
| EntitlementValue.BooleanValueMember
| EntitlementValue.DoubleValueMember
| EntitlementValue.IntegerValueMember
| EntitlementValue.StringValueMember
| EntitlementValue.$UnknownMember;

export namespace EntitlementValue {
export interface EntitlementValue {
/**
* <p>The IntegerValue field will be populated with an integer value when the entitlement is an
* integer type. Otherwise, the field will not be set.</p>
*/
export interface IntegerValueMember {
IntegerValue: number;
DoubleValue?: never;
BooleanValue?: never;
StringValue?: never;
$unknown?: never;
}
IntegerValue?: number;

/**
* <p>The DoubleValue field will be populated with a double value when the entitlement is a
* double type. Otherwise, the field will not be set.</p>
*/
export interface DoubleValueMember {
IntegerValue?: never;
DoubleValue: number;
BooleanValue?: never;
StringValue?: never;
$unknown?: never;
}
DoubleValue?: number;

/**
* <p>The BooleanValue field will be populated with a boolean value when the entitlement is a
* boolean type. Otherwise, the field will not be set.</p>
*/
export interface BooleanValueMember {
IntegerValue?: never;
DoubleValue?: never;
BooleanValue: boolean;
StringValue?: never;
$unknown?: never;
}
BooleanValue?: boolean;

/**
* <p>The StringValue field will be populated with a string value when the entitlement is a
* string type. Otherwise, the field will not be set.</p>
*/
export interface StringValueMember {
IntegerValue?: never;
DoubleValue?: never;
BooleanValue?: never;
StringValue: string;
$unknown?: never;
}

export interface $UnknownMember {
IntegerValue?: never;
DoubleValue?: never;
BooleanValue?: never;
StringValue?: never;
$unknown: [string, any];
}

export interface Visitor<T> {
IntegerValue: (value: number) => T;
DoubleValue: (value: number) => T;
BooleanValue: (value: boolean) => T;
StringValue: (value: string) => T;
_: (name: string, value: any) => T;
}

export const visit = <T>(value: EntitlementValue, visitor: Visitor<T>): T => {
if (value.IntegerValue !== undefined) return visitor.IntegerValue(value.IntegerValue);
if (value.DoubleValue !== undefined) return visitor.DoubleValue(value.DoubleValue);
if (value.BooleanValue !== undefined) return visitor.BooleanValue(value.BooleanValue);
if (value.StringValue !== undefined) return visitor.StringValue(value.StringValue);
return visitor._(value.$unknown[0], value.$unknown[1]);
};
StringValue?: string;
}

/**
Expand Down Expand Up @@ -253,26 +198,20 @@ export const GetEntitlementsRequestFilterSensitiveLog = (obj: GetEntitlementsReq
/**
* @internal
*/
export const EntitlementValueFilterSensitiveLog = (obj: EntitlementValue): any => {
if (obj.IntegerValue !== undefined) return { IntegerValue: obj.IntegerValue };
if (obj.DoubleValue !== undefined) return { DoubleValue: obj.DoubleValue };
if (obj.BooleanValue !== undefined) return { BooleanValue: obj.BooleanValue };
if (obj.StringValue !== undefined) return { StringValue: obj.StringValue };
if (obj.$unknown !== undefined) return { [obj.$unknown[0]]: "UNKNOWN" };
};
export const EntitlementValueFilterSensitiveLog = (obj: EntitlementValue): any => ({
...obj,
});

/**
* @internal
*/
export const EntitlementFilterSensitiveLog = (obj: Entitlement): any => ({
...obj,
...(obj.Value && { Value: EntitlementValueFilterSensitiveLog(obj.Value) }),
});

/**
* @internal
*/
export const GetEntitlementsResultFilterSensitiveLog = (obj: GetEntitlementsResult): any => ({
...obj,
...(obj.Entitlements && { Entitlements: obj.Entitlements.map((item) => EntitlementFilterSensitiveLog(item)) }),
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
expectNonNull as __expectNonNull,
expectNumber as __expectNumber,
expectString as __expectString,
expectUnion as __expectUnion,
limitedParseDouble as __limitedParseDouble,
parseEpochTimestamp as __parseEpochTimestamp,
throwDefaultError,
Expand Down Expand Up @@ -170,8 +169,7 @@ const deserializeAws_json1_1Entitlement = (output: any, context: __SerdeContext)
? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.ExpirationDate)))
: undefined,
ProductCode: __expectString(output.ProductCode),
Value:
output.Value != null ? deserializeAws_json1_1EntitlementValue(__expectUnion(output.Value), context) : undefined,
Value: output.Value != null ? deserializeAws_json1_1EntitlementValue(output.Value, context) : undefined,
} as any;
};

Expand All @@ -188,19 +186,12 @@ const deserializeAws_json1_1EntitlementList = (output: any, context: __SerdeCont
};

const deserializeAws_json1_1EntitlementValue = (output: any, context: __SerdeContext): EntitlementValue => {
if (__expectBoolean(output.BooleanValue) !== undefined) {
return { BooleanValue: __expectBoolean(output.BooleanValue) as any };
}
if (__limitedParseDouble(output.DoubleValue) !== undefined) {
return { DoubleValue: __limitedParseDouble(output.DoubleValue) as any };
}
if (__expectInt32(output.IntegerValue) !== undefined) {
return { IntegerValue: __expectInt32(output.IntegerValue) as any };
}
if (__expectString(output.StringValue) !== undefined) {
return { StringValue: __expectString(output.StringValue) as any };
}
return { $unknown: Object.entries(output)[0] };
return {
BooleanValue: __expectBoolean(output.BooleanValue),
DoubleValue: __limitedParseDouble(output.DoubleValue),
IntegerValue: __expectInt32(output.IntegerValue),
StringValue: __expectString(output.StringValue),
} as any;
};

const deserializeAws_json1_1GetEntitlementsResult = (output: any, context: __SerdeContext): GetEntitlementsResult => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
}
},
"com.amazonaws.marketplaceentitlementservice#EntitlementValue": {
"type": "union",
"type": "structure",
"members": {
"IntegerValue": {
"target": "com.amazonaws.marketplaceentitlementservice#Integer",
Expand Down Expand Up @@ -728,4 +728,4 @@
"type": "timestamp"
}
}
}
}

0 comments on commit eb661ce

Please sign in to comment.