Skip to content

Commit

Permalink
feat(client-connectcases): This release adds the ability to disable t…
Browse files Browse the repository at this point in the history
…emplates through the UpdateTemplate API. Disabling templates prevents customers from creating cases using the template. For more information see https://docs.aws.amazon.com/cases/latest/APIReference/Welcome.html
  • Loading branch information
awstools committed Nov 9, 2022
1 parent 004d6c0 commit c0c724a
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 74 deletions.
22 changes: 12 additions & 10 deletions clients/client-connectcases/src/ConnectCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,12 @@ export class ConnectCases extends ConnectCasesClient {
}

/**
* <p>Creates a template in the Cases domain. This template is used to define the case
* object model (that is, define what data can be captured on cases) in a Cases domain. A
* template must have a unique name within a domain, and it must reference existing field IDs and layout
* IDs. Additionally, multiple fields with same IDs are not allowed within the same Template.</p>
* <p>Creates a template in the Cases domain. This template is used to define the case object
* model (that is, to define what data can be captured on cases) in a Cases domain. A template
* must have a unique name within a domain, and it must reference existing field IDs and layout
* IDs. Additionally, multiple fields with same IDs are not allowed within the same Template. A
* template can be either Active or Inactive, as indicated by its status. Inactive templates
* cannot be used to create cases.</p>
*/
public createTemplate(
args: CreateTemplateCommandInput,
Expand Down Expand Up @@ -880,8 +882,8 @@ export class ConnectCases extends ConnectCasesClient {
}

/**
* <p>Updates the values of fields on a case. Fields to be updated are
* received as an array of id/value pairs identical to the <code>CreateCase</code> input .</p>
* <p>Updates the values of fields on a case. Fields to be updated are received as an array of
* id/value pairs identical to the <code>CreateCase</code> input .</p>
* <p>If the action is successful, the service sends back an HTTP 200 response with an empty
* HTTP body.</p>
*/
Expand Down Expand Up @@ -973,10 +975,10 @@ export class ConnectCases extends ConnectCasesClient {

/**
* <p>Updates the attributes of an existing template. The template attributes that can be
* modified include <code>name</code>, <code>description</code>, <code>layouts</code>,
* and <code>requiredFields</code>. At least one of these
* attributes must not be null. If a null value is provided for a given attribute, that attribute
* is ignored and its current value is preserved.</p>
* modified include <code>name</code>, <code>description</code>,
* <code>layoutConfiguration</code>, <code>requiredFields</code>, and <code>status</code>. At
* least one of these attributes must not be null. If a null value is provided for a given
* attribute, that attribute is ignored and its current value is preserved.</p>
*/
public updateTemplate(
args: UpdateTemplateCommandInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ export interface CreateTemplateCommandInput extends CreateTemplateRequest {}
export interface CreateTemplateCommandOutput extends CreateTemplateResponse, __MetadataBearer {}

/**
* <p>Creates a template in the Cases domain. This template is used to define the case
* object model (that is, define what data can be captured on cases) in a Cases domain. A
* template must have a unique name within a domain, and it must reference existing field IDs and layout
* IDs. Additionally, multiple fields with same IDs are not allowed within the same Template.</p>
* <p>Creates a template in the Cases domain. This template is used to define the case object
* model (that is, to define what data can be captured on cases) in a Cases domain. A template
* must have a unique name within a domain, and it must reference existing field IDs and layout
* IDs. Additionally, multiple fields with same IDs are not allowed within the same Template. A
* template can be either Active or Inactive, as indicated by its status. Inactive templates
* cannot be used to create cases.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
4 changes: 2 additions & 2 deletions clients/client-connectcases/src/commands/UpdateCaseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export interface UpdateCaseCommandInput extends UpdateCaseRequest {}
export interface UpdateCaseCommandOutput extends UpdateCaseResponse, __MetadataBearer {}

/**
* <p>Updates the values of fields on a case. Fields to be updated are
* received as an array of id/value pairs identical to the <code>CreateCase</code> input .</p>
* <p>Updates the values of fields on a case. Fields to be updated are received as an array of
* id/value pairs identical to the <code>CreateCase</code> input .</p>
* <p>If the action is successful, the service sends back an HTTP 200 response with an empty
* HTTP body.</p>
* @example
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export interface UpdateTemplateCommandOutput extends UpdateTemplateResponse, __M

/**
* <p>Updates the attributes of an existing template. The template attributes that can be
* modified include <code>name</code>, <code>description</code>, <code>layouts</code>,
* and <code>requiredFields</code>. At least one of these
* attributes must not be null. If a null value is provided for a given attribute, that attribute
* is ignored and its current value is preserved.</p>
* modified include <code>name</code>, <code>description</code>,
* <code>layoutConfiguration</code>, <code>requiredFields</code>, and <code>status</code>. At
* least one of these attributes must not be null. If a null value is provided for a given
* attribute, that attribute is ignored and its current value is preserved.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
39 changes: 36 additions & 3 deletions clients/client-connectcases/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ export interface CreateCaseRequest {

/**
* <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the
* request.</p>
* request. If not provided, the Amazon Web Services
* SDK populates this field. For more information about idempotency, see
* <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>
*/
clientToken?: string;
}
Expand Down Expand Up @@ -1474,7 +1476,8 @@ export namespace Section {
}

/**
* <p>Ordered list containing different kinds of sections that can be added. A LayoutSections object can only contain one section.</p>
* <p>Ordered list containing different kinds of sections that can be added. A LayoutSections
* object can only contain one section.</p>
*/
export interface LayoutSections {
/**
Expand Down Expand Up @@ -1721,6 +1724,11 @@ export interface RequiredField {
fieldId: string | undefined;
}

export enum TemplateStatus {
ACTIVE = "Active",
INACTIVE = "Inactive",
}

export interface CreateTemplateRequest {
/**
* <p>The unique identifier of the Cases domain. </p>
Expand All @@ -1747,6 +1755,11 @@ export interface CreateTemplateRequest {
* template.</p>
*/
requiredFields?: RequiredField[];

/**
* <p>The status of the template.</p>
*/
status?: TemplateStatus | string;
}

export interface CreateTemplateResponse {
Expand Down Expand Up @@ -1809,6 +1822,11 @@ export interface GetTemplateResponse {
* <p>A map of of key-value pairs that represent tags on a resource. Tags are used to organize, track, or control access for this resource.</p>
*/
tags?: Record<string, string>;

/**
* <p>The status of the template.</p>
*/
status: TemplateStatus | string | undefined;
}

export interface ListTemplatesRequest {
Expand All @@ -1827,6 +1845,11 @@ export interface ListTemplatesRequest {
* response in the next request to retrieve the next set of results.</p>
*/
nextToken?: string;

/**
* <p>A list of status values to filter on.</p>
*/
status?: (TemplateStatus | string)[];
}

/**
Expand All @@ -1839,14 +1862,19 @@ export interface TemplateSummary {
templateId: string | undefined;

/**
* <p>The Amazon Resource Name (ARN) of the template.</p>
* <p>The Amazon Resource Name (ARN) of the template.</p>
*/
templateArn: string | undefined;

/**
* <p>The template name.</p>
*/
name: string | undefined;

/**
* <p>The status of the template.</p>
*/
status: TemplateStatus | string | undefined;
}

export interface ListTemplatesResponse {
Expand Down Expand Up @@ -1892,6 +1920,11 @@ export interface UpdateTemplateRequest {
* template.</p>
*/
requiredFields?: RequiredField[];

/**
* <p>The status of the template.</p>
*/
status?: TemplateStatus | string;
}

export interface UpdateTemplateResponse {}
Expand Down
10 changes: 10 additions & 0 deletions clients/client-connectcases/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export const serializeAws_restJson1CreateTemplateCommand = async (
...(input.requiredFields != null && {
requiredFields: serializeAws_restJson1RequiredFieldList(input.requiredFields, context),
}),
...(input.status != null && { status: input.status }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -619,6 +620,7 @@ export const serializeAws_restJson1ListTemplatesCommand = async (
const query: any = map({
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
nextToken: [, input.nextToken!],
status: [() => input.status !== void 0, () => (input.status! || []).map((_entry) => _entry as any)],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -878,6 +880,7 @@ export const serializeAws_restJson1UpdateTemplateCommand = async (
...(input.requiredFields != null && {
requiredFields: serializeAws_restJson1RequiredFieldList(input.requiredFields, context),
}),
...(input.status != null && { status: input.status }),
});
return new __HttpRequest({
protocol,
Expand Down Expand Up @@ -1639,6 +1642,9 @@ export const deserializeAws_restJson1GetTemplateCommand = async (
if (data.requiredFields != null) {
contents.requiredFields = deserializeAws_restJson1RequiredFieldList(data.requiredFields, context);
}
if (data.status != null) {
contents.status = __expectString(data.status);
}
if (data.tags != null) {
contents.tags = deserializeAws_restJson1Tags(data.tags, context);
}
Expand Down Expand Up @@ -2474,6 +2480,9 @@ const deserializeAws_restJson1UpdateLayoutCommandError = async (
case "ResourceNotFoundException":
case "com.amazonaws.connectcases#ResourceNotFoundException":
throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
case "ServiceQuotaExceededException":
case "com.amazonaws.connectcases#ServiceQuotaExceededException":
throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
case "ThrottlingException":
case "com.amazonaws.connectcases#ThrottlingException":
throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
Expand Down Expand Up @@ -3404,6 +3413,7 @@ const deserializeAws_restJson1Tags = (output: any, context: __SerdeContext): Rec
const deserializeAws_restJson1TemplateSummary = (output: any, context: __SerdeContext): TemplateSummary => {
return {
name: __expectString(output.name),
status: __expectString(output.status),
templateArn: __expectString(output.templateArn),
templateId: __expectString(output.templateId),
} as any;
Expand Down
Loading

0 comments on commit c0c724a

Please sign in to comment.