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.InventoryItem 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.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 collected from managed instances based on your inventory policy document
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InventoryItem implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TYPE_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(InventoryItem::typeName)).setter(setter(Builder::typeName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TypeName").build()).build();
private static final SdkField SCHEMA_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(InventoryItem::schemaVersion)).setter(setter(Builder::schemaVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SchemaVersion").build()).build();
private static final SdkField CAPTURE_TIME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(InventoryItem::captureTime)).setter(setter(Builder::captureTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CaptureTime").build()).build();
private static final SdkField CONTENT_HASH_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(InventoryItem::contentHash)).setter(setter(Builder::contentHash))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContentHash").build()).build();
private static final SdkField>> CONTENT_FIELD = SdkField
.>> builder(MarshallingType.LIST)
.getter(getter(InventoryItem::content))
.setter(setter(Builder::content))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Content").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField.> builder(MarshallingType.MAP)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder()
.location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build())
.build()).build()).build()).build();
private static final SdkField> CONTEXT_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(InventoryItem::context))
.setter(setter(Builder::context))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Context").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(TYPE_NAME_FIELD,
SCHEMA_VERSION_FIELD, CAPTURE_TIME_FIELD, CONTENT_HASH_FIELD, CONTENT_FIELD, CONTEXT_FIELD));
private static final long serialVersionUID = 1L;
private final String typeName;
private final String schemaVersion;
private final String captureTime;
private final String contentHash;
private final List> content;
private final Map context;
private InventoryItem(BuilderImpl builder) {
this.typeName = builder.typeName;
this.schemaVersion = builder.schemaVersion;
this.captureTime = builder.captureTime;
this.contentHash = builder.contentHash;
this.content = builder.content;
this.context = builder.context;
}
/**
*
* The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names
* will start with Custom. Default inventory item types include the following: AWS:AWSComponent, AWS:Application,
* AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.
*
*
* @return The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type
* names will start with Custom. Default inventory item types include the following: AWS:AWSComponent,
* AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.
*/
public String typeName() {
return typeName;
}
/**
*
* The schema version for the inventory item.
*
*
* @return The schema version for the inventory item.
*/
public String schemaVersion() {
return schemaVersion;
}
/**
*
* The time the inventory information was collected.
*
*
* @return The time the inventory information was collected.
*/
public String captureTime() {
return captureTime;
}
/**
*
* MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory
* information. The PutInventory API does not update the inventory item type contents if the MD5 hash has not
* changed since last update.
*
*
* @return MD5 hash of the inventory item type contents. The content hash is used to determine whether to update
* inventory information. The PutInventory API does not update the inventory item type contents if the MD5
* hash has not changed since last update.
*/
public String contentHash() {
return contentHash;
}
/**
* Returns true if the Content 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 hasContent() {
return content != null && !(content instanceof SdkAutoConstructList);
}
/**
*
* The inventory data of the inventory type.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasContent()} to see if a value was sent in this field.
*
*
* @return The inventory data of the inventory type.
*/
public List> content() {
return content;
}
/**
* Returns true if the Context 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 hasContext() {
return context != null && !(context instanceof SdkAutoConstructMap);
}
/**
*
* A map of associated properties for a specified inventory type. For example, with this attribute, you can specify
* the ExecutionId
, ExecutionType
, ComplianceType
properties of the
* AWS:ComplianceItem
type.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasContext()} to see if a value was sent in this field.
*
*
* @return A map of associated properties for a specified inventory type. For example, with this attribute, you can
* specify the ExecutionId
, ExecutionType
, ComplianceType
properties
* of the AWS:ComplianceItem
type.
*/
public Map context() {
return context;
}
@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(typeName());
hashCode = 31 * hashCode + Objects.hashCode(schemaVersion());
hashCode = 31 * hashCode + Objects.hashCode(captureTime());
hashCode = 31 * hashCode + Objects.hashCode(contentHash());
hashCode = 31 * hashCode + Objects.hashCode(content());
hashCode = 31 * hashCode + Objects.hashCode(context());
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 InventoryItem)) {
return false;
}
InventoryItem other = (InventoryItem) obj;
return Objects.equals(typeName(), other.typeName()) && Objects.equals(schemaVersion(), other.schemaVersion())
&& Objects.equals(captureTime(), other.captureTime()) && Objects.equals(contentHash(), other.contentHash())
&& Objects.equals(content(), other.content()) && Objects.equals(context(), other.context());
}
/**
* 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("InventoryItem").add("TypeName", typeName()).add("SchemaVersion", schemaVersion())
.add("CaptureTime", captureTime()).add("ContentHash", contentHash()).add("Content", content())
.add("Context", context()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TypeName":
return Optional.ofNullable(clazz.cast(typeName()));
case "SchemaVersion":
return Optional.ofNullable(clazz.cast(schemaVersion()));
case "CaptureTime":
return Optional.ofNullable(clazz.cast(captureTime()));
case "ContentHash":
return Optional.ofNullable(clazz.cast(contentHash()));
case "Content":
return Optional.ofNullable(clazz.cast(content()));
case "Context":
return Optional.ofNullable(clazz.cast(context()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((InventoryItem) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names
* will start with Custom. Default inventory item types include the following: AWS:AWSComponent,
* AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.
*
*
* @param typeName
* The name of the inventory type. Default inventory item type names start with AWS. Custom inventory
* type names will start with Custom. Default inventory item types include the following:
* AWS:AWSComponent, AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder typeName(String typeName);
/**
*
* The schema version for the inventory item.
*
*
* @param schemaVersion
* The schema version for the inventory item.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder schemaVersion(String schemaVersion);
/**
*
* The time the inventory information was collected.
*
*
* @param captureTime
* The time the inventory information was collected.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder captureTime(String captureTime);
/**
*
* MD5 hash of the inventory item type contents. The content hash is used to determine whether to update
* inventory information. The PutInventory API does not update the inventory item type contents if the MD5 hash
* has not changed since last update.
*
*
* @param contentHash
* MD5 hash of the inventory item type contents. The content hash is used to determine whether to update
* inventory information. The PutInventory API does not update the inventory item type contents if the
* MD5 hash has not changed since last update.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder contentHash(String contentHash);
/**
*
* The inventory data of the inventory type.
*
*
* @param content
* The inventory data of the inventory type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder content(Collection extends Map> content);
/**
*
* The inventory data of the inventory type.
*
*
* @param content
* The inventory data of the inventory type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder content(Map... content);
/**
*
* A map of associated properties for a specified inventory type. For example, with this attribute, you can
* specify the ExecutionId
, ExecutionType
, ComplianceType
properties of
* the AWS:ComplianceItem
type.
*
*
* @param context
* A map of associated properties for a specified inventory type. For example, with this attribute, you
* can specify the ExecutionId
, ExecutionType
, ComplianceType
* properties of the AWS:ComplianceItem
type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder context(Map context);
}
static final class BuilderImpl implements Builder {
private String typeName;
private String schemaVersion;
private String captureTime;
private String contentHash;
private List> content = DefaultSdkAutoConstructList.getInstance();
private Map context = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(InventoryItem model) {
typeName(model.typeName);
schemaVersion(model.schemaVersion);
captureTime(model.captureTime);
contentHash(model.contentHash);
content(model.content);
context(model.context);
}
public final String getTypeName() {
return typeName;
}
@Override
public final Builder typeName(String typeName) {
this.typeName = typeName;
return this;
}
public final void setTypeName(String typeName) {
this.typeName = typeName;
}
public final String getSchemaVersion() {
return schemaVersion;
}
@Override
public final Builder schemaVersion(String schemaVersion) {
this.schemaVersion = schemaVersion;
return this;
}
public final void setSchemaVersion(String schemaVersion) {
this.schemaVersion = schemaVersion;
}
public final String getCaptureTime() {
return captureTime;
}
@Override
public final Builder captureTime(String captureTime) {
this.captureTime = captureTime;
return this;
}
public final void setCaptureTime(String captureTime) {
this.captureTime = captureTime;
}
public final String getContentHash() {
return contentHash;
}
@Override
public final Builder contentHash(String contentHash) {
this.contentHash = contentHash;
return this;
}
public final void setContentHash(String contentHash) {
this.contentHash = contentHash;
}
public final Collection extends Map> getContent() {
return content;
}
@Override
public final Builder content(Collection extends Map> content) {
this.content = InventoryItemEntryListCopier.copy(content);
return this;
}
@Override
@SafeVarargs
public final Builder content(Map... content) {
content(Arrays.asList(content));
return this;
}
public final void setContent(Collection extends Map> content) {
this.content = InventoryItemEntryListCopier.copy(content);
}
public final Map getContext() {
return context;
}
@Override
public final Builder context(Map context) {
this.context = InventoryItemContentContextCopier.copy(context);
return this;
}
public final void setContext(Map context) {
this.context = InventoryItemContentContextCopier.copy(context);
}
@Override
public InventoryItem build() {
return new InventoryItem(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}