software.amazon.awssdk.services.applicationcostprofiler.model.PutReportDefinitionRequest Maven / Gradle / Ivy
Show all versions of applicationcostprofiler Show documentation
/*
* 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.applicationcostprofiler.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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.LocationTrait;
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 PutReportDefinitionRequest extends ApplicationCostProfilerRequest implements
ToCopyableBuilder {
private static final SdkField REPORT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("reportId").getter(getter(PutReportDefinitionRequest::reportId)).setter(setter(Builder::reportId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reportId").build()).build();
private static final SdkField REPORT_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("reportDescription").getter(getter(PutReportDefinitionRequest::reportDescription))
.setter(setter(Builder::reportDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reportDescription").build()).build();
private static final SdkField REPORT_FREQUENCY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("reportFrequency").getter(getter(PutReportDefinitionRequest::reportFrequencyAsString))
.setter(setter(Builder::reportFrequency))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("reportFrequency").build()).build();
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("format")
.getter(getter(PutReportDefinitionRequest::formatAsString)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("format").build()).build();
private static final SdkField DESTINATION_S3_LOCATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("destinationS3Location")
.getter(getter(PutReportDefinitionRequest::destinationS3Location)).setter(setter(Builder::destinationS3Location))
.constructor(S3Location::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destinationS3Location").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(REPORT_ID_FIELD,
REPORT_DESCRIPTION_FIELD, REPORT_FREQUENCY_FIELD, FORMAT_FIELD, DESTINATION_S3_LOCATION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private final String reportId;
private final String reportDescription;
private final String reportFrequency;
private final String format;
private final S3Location destinationS3Location;
private PutReportDefinitionRequest(BuilderImpl builder) {
super(builder);
this.reportId = builder.reportId;
this.reportDescription = builder.reportDescription;
this.reportFrequency = builder.reportFrequency;
this.format = builder.format;
this.destinationS3Location = builder.destinationS3Location;
}
/**
*
* Required. ID of the report. You can choose any valid string matching the pattern for the ID.
*
*
* @return Required. ID of the report. You can choose any valid string matching the pattern for the ID.
*/
public final String reportId() {
return reportId;
}
/**
*
* Required. Description of the report.
*
*
* @return Required. Description of the report.
*/
public final String reportDescription() {
return reportDescription;
}
/**
*
* Required. The cadence to generate the report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reportFrequency}
* will return {@link ReportFrequency#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #reportFrequencyAsString}.
*
*
* @return Required. The cadence to generate the report.
* @see ReportFrequency
*/
public final ReportFrequency reportFrequency() {
return ReportFrequency.fromValue(reportFrequency);
}
/**
*
* Required. The cadence to generate the report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reportFrequency}
* will return {@link ReportFrequency#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #reportFrequencyAsString}.
*
*
* @return Required. The cadence to generate the report.
* @see ReportFrequency
*/
public final String reportFrequencyAsString() {
return reportFrequency;
}
/**
*
* Required. The format to use for the generated report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #format} will
* return {@link Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #formatAsString}.
*
*
* @return Required. The format to use for the generated report.
* @see Format
*/
public final Format format() {
return Format.fromValue(format);
}
/**
*
* Required. The format to use for the generated report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #format} will
* return {@link Format#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #formatAsString}.
*
*
* @return Required. The format to use for the generated report.
* @see Format
*/
public final String formatAsString() {
return format;
}
/**
*
* Required. Amazon Simple Storage Service (Amazon S3) location where Application Cost Profiler uploads the report.
*
*
* @return Required. Amazon Simple Storage Service (Amazon S3) location where Application Cost Profiler uploads the
* report.
*/
public final S3Location destinationS3Location() {
return destinationS3Location;
}
@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(reportId());
hashCode = 31 * hashCode + Objects.hashCode(reportDescription());
hashCode = 31 * hashCode + Objects.hashCode(reportFrequencyAsString());
hashCode = 31 * hashCode + Objects.hashCode(formatAsString());
hashCode = 31 * hashCode + Objects.hashCode(destinationS3Location());
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 PutReportDefinitionRequest)) {
return false;
}
PutReportDefinitionRequest other = (PutReportDefinitionRequest) obj;
return Objects.equals(reportId(), other.reportId()) && Objects.equals(reportDescription(), other.reportDescription())
&& Objects.equals(reportFrequencyAsString(), other.reportFrequencyAsString())
&& Objects.equals(formatAsString(), other.formatAsString())
&& Objects.equals(destinationS3Location(), other.destinationS3Location());
}
/**
* 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("PutReportDefinitionRequest").add("ReportId", reportId())
.add("ReportDescription", reportDescription()).add("ReportFrequency", reportFrequencyAsString())
.add("Format", formatAsString()).add("DestinationS3Location", destinationS3Location()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "reportId":
return Optional.ofNullable(clazz.cast(reportId()));
case "reportDescription":
return Optional.ofNullable(clazz.cast(reportDescription()));
case "reportFrequency":
return Optional.ofNullable(clazz.cast(reportFrequencyAsString()));
case "format":
return Optional.ofNullable(clazz.cast(formatAsString()));
case "destinationS3Location":
return Optional.ofNullable(clazz.cast(destinationS3Location()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("reportId", REPORT_ID_FIELD);
map.put("reportDescription", REPORT_DESCRIPTION_FIELD);
map.put("reportFrequency", REPORT_FREQUENCY_FIELD);
map.put("format", FORMAT_FIELD);
map.put("destinationS3Location", DESTINATION_S3_LOCATION_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function