Skip to content

Commit

Permalink
feat(client-appflow): Enables users to pass custom token URL paramete…
Browse files Browse the repository at this point in the history
…rs for Oauth2 authentication during create connector profile
  • Loading branch information
awstools committed Apr 14, 2022
1 parent 71acd15 commit fc1c8ac
Show file tree
Hide file tree
Showing 3 changed files with 242 additions and 1 deletion.
67 changes: 67 additions & 0 deletions clients/client-appflow/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,61 @@ export namespace CustomAuthConfig {
});
}

export enum OAuth2CustomPropType {
AUTH_URL = "AUTH_URL",
TOKEN_URL = "TOKEN_URL",
}

/**
* <p>Custom parameter required for OAuth 2.0 authentication.</p>
*/
export interface OAuth2CustomParameter {
/**
* <p>The key of the custom parameter required for OAuth 2.0 authentication.</p>
*/
key?: string;

/**
* <p>Indicates whether the custom parameter for OAuth 2.0 authentication is required.</p>
*/
isRequired?: boolean;

/**
* <p>The label of the custom parameter used for OAuth 2.0 authentication.</p>
*/
label?: string;

/**
* <p>A description about the custom parameter used for OAuth 2.0 authentication.</p>
*/
description?: string;

/**
* <p>Indicates whether this authentication custom parameter is a sensitive field.</p>
*/
isSensitiveField?: boolean;

/**
* <p>Contains default values for this authentication parameter that are supplied by the
* connector.</p>
*/
connectorSuppliedValues?: string[];

/**
* <p>Indicates whether custom parameter is used with TokenUrl or AuthUrl.</p>
*/
type?: OAuth2CustomPropType | string;
}

export namespace OAuth2CustomParameter {
/**
* @internal
*/
export const filterSensitiveLog = (obj: OAuth2CustomParameter): any => ({
...obj,
});
}

export enum OAuth2GrantType {
AUTHORIZATION_CODE = "AUTHORIZATION_CODE",
CLIENT_CREDENTIALS = "CLIENT_CREDENTIALS",
Expand Down Expand Up @@ -249,6 +304,11 @@ export interface OAuth2Defaults {
* <p>OAuth 2.0 grant types supported by the connector.</p>
*/
oauth2GrantTypesSupported?: (OAuth2GrantType | string)[];

/**
* <p>List of custom parameters required for OAuth 2.0 authentication.</p>
*/
oauth2CustomProperties?: OAuth2CustomParameter[];
}

export namespace OAuth2Defaults {
Expand Down Expand Up @@ -1903,6 +1963,13 @@ export interface OAuth2Properties {
* <p>The OAuth 2.0 grant type used by connector for OAuth 2.0 authentication.</p>
*/
oAuth2GrantType: OAuth2GrantType | string | undefined;

/**
* <p>Associates your token URL with a map of properties that you define. Use this parameter
* to provide any additional details that the connector requires to authenticate your
* request.</p>
*/
tokenUrlCustomProperties?: { [key: string]: string };
}

export namespace OAuth2Properties {
Expand Down
76 changes: 76 additions & 0 deletions clients/client-appflow/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ import {
MarketoMetadata,
MarketoSourceProperties,
OAuth2Credentials,
OAuth2CustomParameter,
OAuth2Defaults,
OAuth2GrantType,
OAuth2Properties,
Expand Down Expand Up @@ -3060,6 +3061,13 @@ const serializeAws_restJson1OAuth2Properties = (input: OAuth2Properties, context
...(input.oAuth2GrantType !== undefined &&
input.oAuth2GrantType !== null && { oAuth2GrantType: input.oAuth2GrantType }),
...(input.tokenUrl !== undefined && input.tokenUrl !== null && { tokenUrl: input.tokenUrl }),
...(input.tokenUrlCustomProperties !== undefined &&
input.tokenUrlCustomProperties !== null && {
tokenUrlCustomProperties: serializeAws_restJson1TokenUrlCustomProperties(
input.tokenUrlCustomProperties,
context
),
}),
};
};

Expand Down Expand Up @@ -3628,6 +3636,21 @@ const serializeAws_restJson1Tasks = (input: Task[], context: __SerdeContext): an
});
};

const serializeAws_restJson1TokenUrlCustomProperties = (
input: { [key: string]: string },
context: __SerdeContext
): any => {
return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
if (value === null) {
return acc;
}
return {
...acc,
[key]: value,
};
}, {});
};

const serializeAws_restJson1TrendmicroConnectorProfileCredentials = (
input: TrendmicroConnectorProfileCredentials,
context: __SerdeContext
Expand Down Expand Up @@ -4966,12 +4989,46 @@ const deserializeAws_restJson1MarketoSourceProperties = (
} as any;
};

const deserializeAws_restJson1OAuth2CustomParameter = (output: any, context: __SerdeContext): OAuth2CustomParameter => {
return {
connectorSuppliedValues:
output.connectorSuppliedValues !== undefined && output.connectorSuppliedValues !== null
? deserializeAws_restJson1ConnectorSuppliedValueList(output.connectorSuppliedValues, context)
: undefined,
description: __expectString(output.description),
isRequired: __expectBoolean(output.isRequired),
isSensitiveField: __expectBoolean(output.isSensitiveField),
key: __expectString(output.key),
label: __expectString(output.label),
type: __expectString(output.type),
} as any;
};

const deserializeAws_restJson1OAuth2CustomPropertiesList = (
output: any,
context: __SerdeContext
): OAuth2CustomParameter[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
if (entry === null) {
return null as any;
}
return deserializeAws_restJson1OAuth2CustomParameter(entry, context);
});
return retVal;
};

const deserializeAws_restJson1OAuth2Defaults = (output: any, context: __SerdeContext): OAuth2Defaults => {
return {
authCodeUrls:
output.authCodeUrls !== undefined && output.authCodeUrls !== null
? deserializeAws_restJson1AuthCodeUrlList(output.authCodeUrls, context)
: undefined,
oauth2CustomProperties:
output.oauth2CustomProperties !== undefined && output.oauth2CustomProperties !== null
? deserializeAws_restJson1OAuth2CustomPropertiesList(output.oauth2CustomProperties, context)
: undefined,
oauth2GrantTypesSupported:
output.oauth2GrantTypesSupported !== undefined && output.oauth2GrantTypesSupported !== null
? deserializeAws_restJson1OAuth2GrantTypeSupportedList(output.oauth2GrantTypesSupported, context)
Expand Down Expand Up @@ -5006,6 +5063,10 @@ const deserializeAws_restJson1OAuth2Properties = (output: any, context: __SerdeC
return {
oAuth2GrantType: __expectString(output.oAuth2GrantType),
tokenUrl: __expectString(output.tokenUrl),
tokenUrlCustomProperties:
output.tokenUrlCustomProperties !== undefined && output.tokenUrlCustomProperties !== null
? deserializeAws_restJson1TokenUrlCustomProperties(output.tokenUrlCustomProperties, context)
: undefined,
} as any;
};

Expand Down Expand Up @@ -5651,6 +5712,21 @@ const deserializeAws_restJson1Tasks = (output: any, context: __SerdeContext): Ta
return retVal;
};

const deserializeAws_restJson1TokenUrlCustomProperties = (
output: any,
context: __SerdeContext
): { [key: string]: string } => {
return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
if (value === null) {
return acc;
}
return {
...acc,
[key]: __expectString(value) as any,
};
}, {});
};

const deserializeAws_restJson1TokenUrlList = (output: any, context: __SerdeContext): string[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
Expand Down
100 changes: 99 additions & 1 deletion codegen/sdk-codegen/aws-models/appflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"traits": {
"smithy.api#length": {
"min": 0,
"max": 512
"max": 2048
},
"smithy.api#pattern": "^\\S+$"
}
Expand Down Expand Up @@ -4871,6 +4871,77 @@
"smithy.api#documentation": "<p>The OAuth 2.0 credentials required for OAuth 2.0 authentication.</p>"
}
},
"com.amazonaws.appflow#OAuth2CustomParameter": {
"type": "structure",
"members": {
"key": {
"target": "com.amazonaws.appflow#Key",
"traits": {
"smithy.api#documentation": "<p>The key of the custom parameter required for OAuth 2.0 authentication.</p>"
}
},
"isRequired": {
"target": "com.amazonaws.appflow#Boolean",
"traits": {
"smithy.api#documentation": "<p>Indicates whether the custom parameter for OAuth 2.0 authentication is required.</p>"
}
},
"label": {
"target": "com.amazonaws.appflow#Label",
"traits": {
"smithy.api#documentation": "<p>The label of the custom parameter used for OAuth 2.0 authentication.</p>"
}
},
"description": {
"target": "com.amazonaws.appflow#Description",
"traits": {
"smithy.api#documentation": "<p>A description about the custom parameter used for OAuth 2.0 authentication.</p>"
}
},
"isSensitiveField": {
"target": "com.amazonaws.appflow#Boolean",
"traits": {
"smithy.api#documentation": "<p>Indicates whether this authentication custom parameter is a sensitive field.</p>"
}
},
"connectorSuppliedValues": {
"target": "com.amazonaws.appflow#ConnectorSuppliedValueList",
"traits": {
"smithy.api#documentation": "<p>Contains default values for this authentication parameter that are supplied by the\n connector.</p>"
}
},
"type": {
"target": "com.amazonaws.appflow#OAuth2CustomPropType",
"traits": {
"smithy.api#documentation": "<p>Indicates whether custom parameter is used with TokenUrl or AuthUrl.</p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>Custom parameter required for OAuth 2.0 authentication.</p>"
}
},
"com.amazonaws.appflow#OAuth2CustomPropType": {
"type": "string",
"traits": {
"smithy.api#enum": [
{
"value": "TOKEN_URL",
"name": "TOKEN_URL"
},
{
"value": "AUTH_URL",
"name": "AUTH_URL"
}
]
}
},
"com.amazonaws.appflow#OAuth2CustomPropertiesList": {
"type": "list",
"member": {
"target": "com.amazonaws.appflow#OAuth2CustomParameter"
}
},
"com.amazonaws.appflow#OAuth2Defaults": {
"type": "structure",
"members": {
Expand All @@ -4897,6 +4968,12 @@
"traits": {
"smithy.api#documentation": "<p>OAuth 2.0 grant types supported by the connector.</p>"
}
},
"oauth2CustomProperties": {
"target": "com.amazonaws.appflow#OAuth2CustomPropertiesList",
"traits": {
"smithy.api#documentation": "<p>List of custom parameters required for OAuth 2.0 authentication.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -4940,6 +5017,12 @@
"smithy.api#documentation": "<p>The OAuth 2.0 grant type used by connector for OAuth 2.0 authentication.</p>",
"smithy.api#required": {}
}
},
"tokenUrlCustomProperties": {
"target": "com.amazonaws.appflow#TokenUrlCustomProperties",
"traits": {
"smithy.api#documentation": "<p>Associates your token URL with a map of properties that you define. Use this parameter\n to provide any additional details that the connector requires to authenticate your\n request.</p>"
}
}
},
"traits": {
Expand Down Expand Up @@ -7799,6 +7882,21 @@
"smithy.api#pattern": "^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]$"
}
},
"com.amazonaws.appflow#TokenUrlCustomProperties": {
"type": "map",
"key": {
"target": "com.amazonaws.appflow#CustomPropertyKey"
},
"value": {
"target": "com.amazonaws.appflow#CustomPropertyValue"
},
"traits": {
"smithy.api#length": {
"min": 0,
"max": 50
}
}
},
"com.amazonaws.appflow#TokenUrlList": {
"type": "list",
"member": {
Expand Down

0 comments on commit fc1c8ac

Please sign in to comment.