createCase method

Future<CreateCaseResponse> createCase({
  1. required String communicationBody,
  2. required String subject,
  3. String? attachmentSetId,
  4. String? categoryCode,
  5. List<String>? ccEmailAddresses,
  6. String? issueType,
  7. String? language,
  8. String? serviceCode,
  9. String? severityCode,
})

Creates a case in the AWS Support Center. This operation is similar to how you create a case in the AWS Support Center Create Case page.

The AWS Support API doesn't support requesting service limit increases. You can submit a service limit increase in the following ways:

A successful CreateCase request returns an AWS Support case number. You can use the DescribeCases operation and specify the case number to get existing AWS Support cases. After you create a case, use the AddCommunicationToCase operation to add additional communication or attachments to an existing case.

The caseId is separate from the displayId that appears in the AWS Support Center. Use the DescribeCases operation to get the displayId.

  • You must have a Business or Enterprise support plan to use the AWS Support API.
  • If you call the AWS Support API from an account that does not have a Business or Enterprise support plan, the SubscriptionRequiredException error message appears. For information about changing your support plan, see AWS Support.

May throw InternalServerError. May throw CaseCreationLimitExceeded. May throw AttachmentSetIdNotFound. May throw AttachmentSetExpired.

Parameter communicationBody : The communication body text that describes the issue. This text appears in the Description field on the AWS Support Center Create Case page.

Parameter subject : The title of the AWS Support case. The title appears in the Subject field on the AWS Support Center Create Case page.

Parameter attachmentSetId : The ID of a set of one or more attachments for the case. Create the set by using the AddAttachmentsToSet operation.

Parameter categoryCode : The category of problem for the AWS Support case. You also use the DescribeServices operation to get the category code for a service. Each AWS service defines its own set of category codes.

Parameter ccEmailAddresses : A list of email addresses that AWS Support copies on case correspondence. AWS Support identifies the account that creates the case when you specify your AWS credentials in an HTTP POST method or use the AWS SDKs.

Parameter issueType : The type of issue for the case. You can specify customer-service or technical. If you don't specify a value, the default is technical.

Parameter language : The language in which AWS Support handles the case. You must specify the ISO 639-1 code for the language parameter if you want support in that language. Currently, English ("en") and Japanese ("ja") are supported.

Parameter serviceCode : The code for the AWS service. You can use the DescribeServices operation to get the possible serviceCode values.

Parameter severityCode : A value that indicates the urgency of the case. This value determines the response time according to your service level agreement with AWS Support. You can use the DescribeSeverityLevels operation to get the possible values for severityCode.

For more information, see SeverityLevel and Choosing a Severity in the AWS Support User Guide.

Implementation

Future<CreateCaseResponse> createCase({
  required String communicationBody,
  required String subject,
  String? attachmentSetId,
  String? categoryCode,
  List<String>? ccEmailAddresses,
  String? issueType,
  String? language,
  String? serviceCode,
  String? severityCode,
}) async {
  ArgumentError.checkNotNull(communicationBody, 'communicationBody');
  _s.validateStringLength(
    'communicationBody',
    communicationBody,
    1,
    8000,
    isRequired: true,
  );
  ArgumentError.checkNotNull(subject, 'subject');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSupport_20130415.CreateCase'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'communicationBody': communicationBody,
      'subject': subject,
      if (attachmentSetId != null) 'attachmentSetId': attachmentSetId,
      if (categoryCode != null) 'categoryCode': categoryCode,
      if (ccEmailAddresses != null) 'ccEmailAddresses': ccEmailAddresses,
      if (issueType != null) 'issueType': issueType,
      if (language != null) 'language': language,
      if (serviceCode != null) 'serviceCode': serviceCode,
      if (severityCode != null) 'severityCode': severityCode,
    },
  );

  return CreateCaseResponse.fromJson(jsonResponse.body);
}