
software.amazon.awssdk.services.support.model.CreateCaseRequest Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.support.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateCaseRequest extends SupportRequest implements
ToCopyableBuilder {
private static final SdkField SUBJECT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("subject")
.getter(getter(CreateCaseRequest::subject)).setter(setter(Builder::subject))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("subject").build()).build();
private static final SdkField SERVICE_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("serviceCode").getter(getter(CreateCaseRequest::serviceCode)).setter(setter(Builder::serviceCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("serviceCode").build()).build();
private static final SdkField SEVERITY_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("severityCode").getter(getter(CreateCaseRequest::severityCode)).setter(setter(Builder::severityCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("severityCode").build()).build();
private static final SdkField CATEGORY_CODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("categoryCode").getter(getter(CreateCaseRequest::categoryCode)).setter(setter(Builder::categoryCode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("categoryCode").build()).build();
private static final SdkField COMMUNICATION_BODY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("communicationBody").getter(getter(CreateCaseRequest::communicationBody))
.setter(setter(Builder::communicationBody))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("communicationBody").build()).build();
private static final SdkField> CC_EMAIL_ADDRESSES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ccEmailAddresses")
.getter(getter(CreateCaseRequest::ccEmailAddresses))
.setter(setter(Builder::ccEmailAddresses))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ccEmailAddresses").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField LANGUAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("language").getter(getter(CreateCaseRequest::language)).setter(setter(Builder::language))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("language").build()).build();
private static final SdkField ISSUE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("issueType").getter(getter(CreateCaseRequest::issueType)).setter(setter(Builder::issueType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("issueType").build()).build();
private static final SdkField ATTACHMENT_SET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("attachmentSetId").getter(getter(CreateCaseRequest::attachmentSetId))
.setter(setter(Builder::attachmentSetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("attachmentSetId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SUBJECT_FIELD,
SERVICE_CODE_FIELD, SEVERITY_CODE_FIELD, CATEGORY_CODE_FIELD, COMMUNICATION_BODY_FIELD, CC_EMAIL_ADDRESSES_FIELD,
LANGUAGE_FIELD, ISSUE_TYPE_FIELD, ATTACHMENT_SET_ID_FIELD));
private final String subject;
private final String serviceCode;
private final String severityCode;
private final String categoryCode;
private final String communicationBody;
private final List ccEmailAddresses;
private final String language;
private final String issueType;
private final String attachmentSetId;
private CreateCaseRequest(BuilderImpl builder) {
super(builder);
this.subject = builder.subject;
this.serviceCode = builder.serviceCode;
this.severityCode = builder.severityCode;
this.categoryCode = builder.categoryCode;
this.communicationBody = builder.communicationBody;
this.ccEmailAddresses = builder.ccEmailAddresses;
this.language = builder.language;
this.issueType = builder.issueType;
this.attachmentSetId = builder.attachmentSetId;
}
/**
*
* The title of the support case. The title appears in the Subject field on the Amazon Web Services Support
* Center Create Case page.
*
*
* @return The title of the support case. The title appears in the Subject field on the Amazon Web Services
* Support Center Create Case page.
*/
public final String subject() {
return subject;
}
/**
*
* The code for the Amazon Web Services service. You can use the DescribeServices operation to get the
* possible serviceCode
values.
*
*
* @return The code for the Amazon Web Services service. You can use the DescribeServices operation to get
* the possible serviceCode
values.
*/
public final String serviceCode() {
return serviceCode;
}
/**
*
* A value that indicates the urgency of the case. This value determines the response time according to your service
* level agreement with Amazon Web Services 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 Amazon Web Services Support User Guide.
*
*
*
* The availability of severity levels depends on the support plan for the Amazon Web Services account.
*
*
*
* @return A value that indicates the urgency of the case. This value determines the response time according to your
* service level agreement with Amazon Web Services 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 Amazon Web Services Support User Guide.
*
*
*
* The availability of severity levels depends on the support plan for the Amazon Web Services account.
*
*/
public final String severityCode() {
return severityCode;
}
/**
*
* The category of problem for the support case. You also use the DescribeServices operation to get the
* category code for a service. Each Amazon Web Services service defines its own set of category codes.
*
*
* @return The category of problem for the support case. You also use the DescribeServices operation to get
* the category code for a service. Each Amazon Web Services service defines its own set of category codes.
*/
public final String categoryCode() {
return categoryCode;
}
/**
*
* The communication body text that describes the issue. This text appears in the Description field on the
* Amazon Web Services Support Center Create
* Case page.
*
*
* @return The communication body text that describes the issue. This text appears in the Description field
* on the Amazon Web Services Support Center Create Case page.
*/
public final String communicationBody() {
return communicationBody;
}
/**
* For responses, this returns true if the service returned a value for the CcEmailAddresses property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasCcEmailAddresses() {
return ccEmailAddresses != null && !(ccEmailAddresses instanceof SdkAutoConstructList);
}
/**
*
* A list of email addresses that Amazon Web Services Support copies on case correspondence. Amazon Web Services
* Support identifies the account that creates the case when you specify your Amazon Web Services credentials in an
* HTTP POST method or use the Amazon Web Services SDKs.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasCcEmailAddresses} method.
*
*
* @return A list of email addresses that Amazon Web Services Support copies on case correspondence. Amazon Web
* Services Support identifies the account that creates the case when you specify your Amazon Web Services
* credentials in an HTTP POST method or use the Amazon Web Services
* SDKs.
*/
public final List ccEmailAddresses() {
return ccEmailAddresses;
}
/**
*
* The language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently
* supports Chinese (“zh”), English ("en"), Japanese ("ja") and Korean (“ko”). You must specify the ISO 639-1 code
* for the language
parameter if you want support in that language.
*
*
* @return The language in which Amazon Web Services Support handles the case. Amazon Web Services Support currently
* supports Chinese (“zh”), English ("en"), Japanese ("ja") and Korean (“ko”). You must specify the ISO
* 639-1 code for the language
parameter if you want support in that language.
*/
public final String language() {
return language;
}
/**
*
* 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
.
*
*
* @return 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
.
*/
public final String issueType() {
return issueType;
}
/**
*
* The ID of a set of one or more attachments for the case. Create the set by using the AddAttachmentsToSet
* operation.
*
*
* @return The ID of a set of one or more attachments for the case. Create the set by using the
* AddAttachmentsToSet operation.
*/
public final String attachmentSetId() {
return attachmentSetId;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(subject());
hashCode = 31 * hashCode + Objects.hashCode(serviceCode());
hashCode = 31 * hashCode + Objects.hashCode(severityCode());
hashCode = 31 * hashCode + Objects.hashCode(categoryCode());
hashCode = 31 * hashCode + Objects.hashCode(communicationBody());
hashCode = 31 * hashCode + Objects.hashCode(hasCcEmailAddresses() ? ccEmailAddresses() : null);
hashCode = 31 * hashCode + Objects.hashCode(language());
hashCode = 31 * hashCode + Objects.hashCode(issueType());
hashCode = 31 * hashCode + Objects.hashCode(attachmentSetId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateCaseRequest)) {
return false;
}
CreateCaseRequest other = (CreateCaseRequest) obj;
return Objects.equals(subject(), other.subject()) && Objects.equals(serviceCode(), other.serviceCode())
&& Objects.equals(severityCode(), other.severityCode()) && Objects.equals(categoryCode(), other.categoryCode())
&& Objects.equals(communicationBody(), other.communicationBody())
&& hasCcEmailAddresses() == other.hasCcEmailAddresses()
&& Objects.equals(ccEmailAddresses(), other.ccEmailAddresses()) && Objects.equals(language(), other.language())
&& Objects.equals(issueType(), other.issueType()) && Objects.equals(attachmentSetId(), other.attachmentSetId());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("CreateCaseRequest").add("Subject", subject()).add("ServiceCode", serviceCode())
.add("SeverityCode", severityCode()).add("CategoryCode", categoryCode())
.add("CommunicationBody", communicationBody())
.add("CcEmailAddresses", hasCcEmailAddresses() ? ccEmailAddresses() : null).add("Language", language())
.add("IssueType", issueType()).add("AttachmentSetId", attachmentSetId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "subject":
return Optional.ofNullable(clazz.cast(subject()));
case "serviceCode":
return Optional.ofNullable(clazz.cast(serviceCode()));
case "severityCode":
return Optional.ofNullable(clazz.cast(severityCode()));
case "categoryCode":
return Optional.ofNullable(clazz.cast(categoryCode()));
case "communicationBody":
return Optional.ofNullable(clazz.cast(communicationBody()));
case "ccEmailAddresses":
return Optional.ofNullable(clazz.cast(ccEmailAddresses()));
case "language":
return Optional.ofNullable(clazz.cast(language()));
case "issueType":
return Optional.ofNullable(clazz.cast(issueType()));
case "attachmentSetId":
return Optional.ofNullable(clazz.cast(attachmentSetId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function