Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.ssm.model.ComplianceItemEntry 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.ssm.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
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.Function;
import software.amazon.awssdk.annotations.Generated;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about a compliance item.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ComplianceItemEntry implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ComplianceItemEntry::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ComplianceItemEntry::title)).setter(setter(Builder::title))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build();
private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ComplianceItemEntry::severityAsString)).setter(setter(Builder::severity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ComplianceItemEntry::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField> DETAILS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(ComplianceItemEntry::details))
.setter(setter(Builder::details))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Details").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, TITLE_FIELD,
SEVERITY_FIELD, STATUS_FIELD, DETAILS_FIELD));
private static final long serialVersionUID = 1L;
private final String id;
private final String title;
private final String severity;
private final String status;
private final Map details;
private ComplianceItemEntry(BuilderImpl builder) {
this.id = builder.id;
this.title = builder.title;
this.severity = builder.severity;
this.status = builder.status;
this.details = builder.details;
}
/**
*
* The compliance item ID. For example, if the compliance item is a Windows patch, the ID could be the number of the
* KB article.
*
*
* @return The compliance item ID. For example, if the compliance item is a Windows patch, the ID could be the
* number of the KB article.
*/
public String id() {
return id;
}
/**
*
* The title of the compliance item. For example, if the compliance item is a Windows patch, the title could be the
* title of the KB article for the patch; for example: Security Update for Active Directory Federation Services.
*
*
* @return The title of the compliance item. For example, if the compliance item is a Windows patch, the title could
* be the title of the KB article for the patch; for example: Security Update for Active Directory
* Federation Services.
*/
public String title() {
return title;
}
/**
*
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link ComplianceSeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
* @see ComplianceSeverity
*/
public ComplianceSeverity severity() {
return ComplianceSeverity.fromValue(severity);
}
/**
*
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #severity} will
* return {@link ComplianceSeverity#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #severityAsString}.
*
*
* @return The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
* @see ComplianceSeverity
*/
public String severityAsString() {
return severity;
}
/**
*
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ComplianceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
* @see ComplianceStatus
*/
public ComplianceStatus status() {
return ComplianceStatus.fromValue(status);
}
/**
*
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ComplianceStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
* @see ComplianceStatus
*/
public String statusAsString() {
return status;
}
/**
* Returns true if the Details property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasDetails() {
return details != null && !(details instanceof SdkAutoConstructMap);
}
/**
*
* A "Key": "Value" tag combination for the compliance item.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasDetails()} to see if a value was sent in this field.
*
*
* @return A "Key": "Value" tag combination for the compliance item.
*/
public Map details() {
return details;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(title());
hashCode = 31 * hashCode + Objects.hashCode(severityAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(details());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ComplianceItemEntry)) {
return false;
}
ComplianceItemEntry other = (ComplianceItemEntry) obj;
return Objects.equals(id(), other.id()) && Objects.equals(title(), other.title())
&& Objects.equals(severityAsString(), other.severityAsString())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(details(), other.details());
}
/**
* 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 String toString() {
return ToString.builder("ComplianceItemEntry").add("Id", id()).add("Title", title()).add("Severity", severityAsString())
.add("Status", statusAsString()).add("Details", details()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Title":
return Optional.ofNullable(clazz.cast(title()));
case "Severity":
return Optional.ofNullable(clazz.cast(severityAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "Details":
return Optional.ofNullable(clazz.cast(details()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((ComplianceItemEntry) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The compliance item ID. For example, if the compliance item is a Windows patch, the ID could be the number of
* the KB article.
*
*
* @param id
* The compliance item ID. For example, if the compliance item is a Windows patch, the ID could be the
* number of the KB article.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The title of the compliance item. For example, if the compliance item is a Windows patch, the title could be
* the title of the KB article for the patch; for example: Security Update for Active Directory Federation
* Services.
*
*
* @param title
* The title of the compliance item. For example, if the compliance item is a Windows patch, the title
* could be the title of the KB article for the patch; for example: Security Update for Active Directory
* Federation Services.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder title(String title);
/**
*
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
*
*
* @param severity
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium,
* Low, Informational, Unspecified.
* @see ComplianceSeverity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComplianceSeverity
*/
Builder severity(String severity);
/**
*
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium, Low,
* Informational, Unspecified.
*
*
* @param severity
* The severity of the compliance status. Severity can be one of the following: Critical, High, Medium,
* Low, Informational, Unspecified.
* @see ComplianceSeverity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComplianceSeverity
*/
Builder severity(ComplianceSeverity severity);
/**
*
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
*
*
* @param status
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
* @see ComplianceStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComplianceStatus
*/
Builder status(String status);
/**
*
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
*
*
* @param status
* The status of the compliance item. An item is either COMPLIANT or NON_COMPLIANT.
* @see ComplianceStatus
* @return Returns a reference to this object so that method calls can be chained together.
* @see ComplianceStatus
*/
Builder status(ComplianceStatus status);
/**
*
* A "Key": "Value" tag combination for the compliance item.
*
*
* @param details
* A "Key": "Value" tag combination for the compliance item.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder details(Map details);
}
static final class BuilderImpl implements Builder {
private String id;
private String title;
private String severity;
private String status;
private Map details = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(ComplianceItemEntry model) {
id(model.id);
title(model.title);
severity(model.severity);
status(model.status);
details(model.details);
}
public final String getId() {
return id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final void setId(String id) {
this.id = id;
}
public final String getTitle() {
return title;
}
@Override
public final Builder title(String title) {
this.title = title;
return this;
}
public final void setTitle(String title) {
this.title = title;
}
public final String getSeverity() {
return severity;
}
@Override
public final Builder severity(String severity) {
this.severity = severity;
return this;
}
@Override
public final Builder severity(ComplianceSeverity severity) {
this.severity(severity == null ? null : severity.toString());
return this;
}
public final void setSeverity(String severity) {
this.severity = severity;
}
public final String getStatus() {
return status;
}
@Override
public final Builder status(String status) {
this.status = status;
return this;
}
@Override
public final Builder status(ComplianceStatus status) {
this.status(status == null ? null : status.toString());
return this;
}
public final void setStatus(String status) {
this.status = status;
}
public final Map getDetails() {
return details;
}
@Override
public final Builder details(Map details) {
this.details = ComplianceItemDetailsCopier.copy(details);
return this;
}
public final void setDetails(Map details) {
this.details = ComplianceItemDetailsCopier.copy(details);
}
@Override
public ComplianceItemEntry build() {
return new ComplianceItemEntry(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}