software.amazon.awssdk.services.ram.model.ResourceSharePermissionDetail Maven / Gradle / Ivy
Show all versions of ram 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.ram.model;
import java.io.Serializable;
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.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;
/**
*
* Information about an RAM permission.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ResourceSharePermissionDetail implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("arn")
.getter(getter(ResourceSharePermissionDetail::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING).memberName("version")
.getter(getter(ResourceSharePermissionDetail::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField DEFAULT_VERSION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("defaultVersion").getter(getter(ResourceSharePermissionDetail::defaultVersion))
.setter(setter(Builder::defaultVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("defaultVersion").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name")
.getter(getter(ResourceSharePermissionDetail::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resourceType").getter(getter(ResourceSharePermissionDetail::resourceType))
.setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceType").build()).build();
private static final SdkField PERMISSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("permission").getter(getter(ResourceSharePermissionDetail::permission))
.setter(setter(Builder::permission))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("permission").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTime").getter(getter(ResourceSharePermissionDetail::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTime").build()).build();
private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastUpdatedTime").getter(getter(ResourceSharePermissionDetail::lastUpdatedTime))
.setter(setter(Builder::lastUpdatedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedTime").build()).build();
private static final SdkField IS_RESOURCE_TYPE_DEFAULT_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("isResourceTypeDefault").getter(getter(ResourceSharePermissionDetail::isResourceTypeDefault))
.setter(setter(Builder::isResourceTypeDefault))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isResourceTypeDefault").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, VERSION_FIELD,
DEFAULT_VERSION_FIELD, NAME_FIELD, RESOURCE_TYPE_FIELD, PERMISSION_FIELD, CREATION_TIME_FIELD,
LAST_UPDATED_TIME_FIELD, IS_RESOURCE_TYPE_DEFAULT_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String version;
private final Boolean defaultVersion;
private final String name;
private final String resourceType;
private final String permission;
private final Instant creationTime;
private final Instant lastUpdatedTime;
private final Boolean isResourceTypeDefault;
private ResourceSharePermissionDetail(BuilderImpl builder) {
this.arn = builder.arn;
this.version = builder.version;
this.defaultVersion = builder.defaultVersion;
this.name = builder.name;
this.resourceType = builder.resourceType;
this.permission = builder.permission;
this.creationTime = builder.creationTime;
this.lastUpdatedTime = builder.lastUpdatedTime;
this.isResourceTypeDefault = builder.isResourceTypeDefault;
}
/**
*
* The Amazon Resoure Name
* (ARN) of this RAM permission.
*
*
* @return The Amazon Resoure
* Name (ARN) of this RAM permission.
*/
public final String arn() {
return arn;
}
/**
*
* The version of the permission represented in this structure.
*
*
* @return The version of the permission represented in this structure.
*/
public final String version() {
return version;
}
/**
*
* Specifies whether the version of the permission represented in this structure is the default version for this
* permission.
*
*
* @return Specifies whether the version of the permission represented in this structure is the default version for
* this permission.
*/
public final Boolean defaultVersion() {
return defaultVersion;
}
/**
*
* The name of this permission.
*
*
* @return The name of this permission.
*/
public final String name() {
return name;
}
/**
*
* The resource type to which this permission applies.
*
*
* @return The resource type to which this permission applies.
*/
public final String resourceType() {
return resourceType;
}
/**
*
* The permission's effect and actions in JSON format. The effect
indicates whether the specified
* actions are allowed or denied. The actions
list the operations to which the principal is granted or
* denied access.
*
*
* @return The permission's effect and actions in JSON format. The effect
indicates whether the
* specified actions are allowed or denied. The actions
list the operations to which the
* principal is granted or denied access.
*/
public final String permission() {
return permission;
}
/**
*
* The date and time when the permission was created.
*
*
* @return The date and time when the permission was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The date and time when the permission was last updated.
*
*
* @return The date and time when the permission was last updated.
*/
public final Instant lastUpdatedTime() {
return lastUpdatedTime;
}
/**
*
* Specifies whether the version of the permission represented in this structure is the default version for all
* resources of this resource type.
*
*
* @return Specifies whether the version of the permission represented in this structure is the default version for
* all resources of this resource type.
*/
public final Boolean isResourceTypeDefault() {
return isResourceTypeDefault;
}
@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 + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(defaultVersion());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(resourceType());
hashCode = 31 * hashCode + Objects.hashCode(permission());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime());
hashCode = 31 * hashCode + Objects.hashCode(isResourceTypeDefault());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ResourceSharePermissionDetail)) {
return false;
}
ResourceSharePermissionDetail other = (ResourceSharePermissionDetail) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(version(), other.version())
&& Objects.equals(defaultVersion(), other.defaultVersion()) && Objects.equals(name(), other.name())
&& Objects.equals(resourceType(), other.resourceType()) && Objects.equals(permission(), other.permission())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastUpdatedTime(), other.lastUpdatedTime())
&& Objects.equals(isResourceTypeDefault(), other.isResourceTypeDefault());
}
/**
* 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("ResourceSharePermissionDetail").add("Arn", arn()).add("Version", version())
.add("DefaultVersion", defaultVersion()).add("Name", name()).add("ResourceType", resourceType())
.add("Permission", permission()).add("CreationTime", creationTime()).add("LastUpdatedTime", lastUpdatedTime())
.add("IsResourceTypeDefault", isResourceTypeDefault()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "defaultVersion":
return Optional.ofNullable(clazz.cast(defaultVersion()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "resourceType":
return Optional.ofNullable(clazz.cast(resourceType()));
case "permission":
return Optional.ofNullable(clazz.cast(permission()));
case "creationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "lastUpdatedTime":
return Optional.ofNullable(clazz.cast(lastUpdatedTime()));
case "isResourceTypeDefault":
return Optional.ofNullable(clazz.cast(isResourceTypeDefault()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function