software.amazon.awssdk.services.iam.model.GetCredentialReportResponse Maven / Gradle / Ivy
Show all versions of iam 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.iam.model;
import java.nio.ByteBuffer;
import java.time.Instant;
import java.util.Arrays;
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.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkBytes;
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;
/**
*
* Contains the response to a successful GetCredentialReport request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetCredentialReportResponse extends IamResponse implements
ToCopyableBuilder {
private static final SdkField CONTENT_FIELD = SdkField. builder(MarshallingType.SDK_BYTES)
.memberName("Content").getter(getter(GetCredentialReportResponse::content)).setter(setter(Builder::content))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Content").build()).build();
private static final SdkField REPORT_FORMAT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ReportFormat").getter(getter(GetCredentialReportResponse::reportFormatAsString))
.setter(setter(Builder::reportFormat))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReportFormat").build()).build();
private static final SdkField GENERATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("GeneratedTime").getter(getter(GetCredentialReportResponse::generatedTime))
.setter(setter(Builder::generatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeneratedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CONTENT_FIELD,
REPORT_FORMAT_FIELD, GENERATED_TIME_FIELD));
private final SdkBytes content;
private final String reportFormat;
private final Instant generatedTime;
private GetCredentialReportResponse(BuilderImpl builder) {
super(builder);
this.content = builder.content;
this.reportFormat = builder.reportFormat;
this.generatedTime = builder.generatedTime;
}
/**
*
* Contains the credential report. The report is Base64-encoded.
*
*
* @return Contains the credential report. The report is Base64-encoded.
*/
public final SdkBytes content() {
return content;
}
/**
*
* The format (MIME type) of the credential report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reportFormat} will
* return {@link ReportFormatType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #reportFormatAsString}.
*
*
* @return The format (MIME type) of the credential report.
* @see ReportFormatType
*/
public final ReportFormatType reportFormat() {
return ReportFormatType.fromValue(reportFormat);
}
/**
*
* The format (MIME type) of the credential report.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #reportFormat} will
* return {@link ReportFormatType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #reportFormatAsString}.
*
*
* @return The format (MIME type) of the credential report.
* @see ReportFormatType
*/
public final String reportFormatAsString() {
return reportFormat;
}
/**
*
* The date and time when the credential report was created, in ISO 8601
* date-time format.
*
*
* @return The date and time when the credential report was created, in ISO
* 8601 date-time format.
*/
public final Instant generatedTime() {
return generatedTime;
}
@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(content());
hashCode = 31 * hashCode + Objects.hashCode(reportFormatAsString());
hashCode = 31 * hashCode + Objects.hashCode(generatedTime());
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 GetCredentialReportResponse)) {
return false;
}
GetCredentialReportResponse other = (GetCredentialReportResponse) obj;
return Objects.equals(content(), other.content()) && Objects.equals(reportFormatAsString(), other.reportFormatAsString())
&& Objects.equals(generatedTime(), other.generatedTime());
}
/**
* 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("GetCredentialReportResponse").add("Content", content())
.add("ReportFormat", reportFormatAsString()).add("GeneratedTime", generatedTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Content":
return Optional.ofNullable(clazz.cast(content()));
case "ReportFormat":
return Optional.ofNullable(clazz.cast(reportFormatAsString()));
case "GeneratedTime":
return Optional.ofNullable(clazz.cast(generatedTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function