software.amazon.awssdk.services.quicksight.model.RowLevelPermissionDataSet Maven / Gradle / Ivy
Show all versions of quicksight 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.quicksight.model;
import java.io.Serializable;
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 a dataset that contains permissions for row-level security (RLS). The permissions dataset maps
* fields to users or groups. For more information, see Using Row-Level Security (RLS) to Restrict Access to a Dataset in the Amazon QuickSight User Guide.
*
*
* The option to deny permissions by setting PermissionPolicy
to DENY_ACCESS
is not supported
* for new RLS datasets.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RowLevelPermissionDataSet implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAMESPACE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Namespace").getter(getter(RowLevelPermissionDataSet::namespace)).setter(setter(Builder::namespace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Namespace").build()).build();
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(RowLevelPermissionDataSet::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField PERMISSION_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PermissionPolicy").getter(getter(RowLevelPermissionDataSet::permissionPolicyAsString))
.setter(setter(Builder::permissionPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PermissionPolicy").build()).build();
private static final SdkField FORMAT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("FormatVersion").getter(getter(RowLevelPermissionDataSet::formatVersionAsString))
.setter(setter(Builder::formatVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FormatVersion").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(RowLevelPermissionDataSet::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAMESPACE_FIELD, ARN_FIELD,
PERMISSION_POLICY_FIELD, FORMAT_VERSION_FIELD, STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String namespace;
private final String arn;
private final String permissionPolicy;
private final String formatVersion;
private final String status;
private RowLevelPermissionDataSet(BuilderImpl builder) {
this.namespace = builder.namespace;
this.arn = builder.arn;
this.permissionPolicy = builder.permissionPolicy;
this.formatVersion = builder.formatVersion;
this.status = builder.status;
}
/**
*
* The namespace associated with the dataset that contains permissions for RLS.
*
*
* @return The namespace associated with the dataset that contains permissions for RLS.
*/
public final String namespace() {
return namespace;
}
/**
*
* The Amazon Resource Name (ARN) of the dataset that contains permissions for RLS.
*
*
* @return The Amazon Resource Name (ARN) of the dataset that contains permissions for RLS.
*/
public final String arn() {
return arn;
}
/**
*
* The type of permissions to use when interpreting the permissions for RLS. DENY_ACCESS
is included
* for backward compatibility only.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #permissionPolicy}
* will return {@link RowLevelPermissionPolicy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #permissionPolicyAsString}.
*
*
* @return The type of permissions to use when interpreting the permissions for RLS. DENY_ACCESS
is
* included for backward compatibility only.
* @see RowLevelPermissionPolicy
*/
public final RowLevelPermissionPolicy permissionPolicy() {
return RowLevelPermissionPolicy.fromValue(permissionPolicy);
}
/**
*
* The type of permissions to use when interpreting the permissions for RLS. DENY_ACCESS
is included
* for backward compatibility only.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #permissionPolicy}
* will return {@link RowLevelPermissionPolicy#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #permissionPolicyAsString}.
*
*
* @return The type of permissions to use when interpreting the permissions for RLS. DENY_ACCESS
is
* included for backward compatibility only.
* @see RowLevelPermissionPolicy
*/
public final String permissionPolicyAsString() {
return permissionPolicy;
}
/**
*
* The user or group rules associated with the dataset that contains permissions for RLS.
*
*
* By default, FormatVersion
is VERSION_1
. When FormatVersion
is
* VERSION_1
, UserName
and GroupName
are required. When
* FormatVersion
is VERSION_2
, UserARN
and GroupARN
are
* required, and Namespace
must not exist.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #formatVersion}
* will return {@link RowLevelPermissionFormatVersion#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #formatVersionAsString}.
*
*
* @return The user or group rules associated with the dataset that contains permissions for RLS.
*
* By default, FormatVersion
is VERSION_1
. When FormatVersion
is
* VERSION_1
, UserName
and GroupName
are required. When
* FormatVersion
is VERSION_2
, UserARN
and GroupARN
are
* required, and Namespace
must not exist.
* @see RowLevelPermissionFormatVersion
*/
public final RowLevelPermissionFormatVersion formatVersion() {
return RowLevelPermissionFormatVersion.fromValue(formatVersion);
}
/**
*
* The user or group rules associated with the dataset that contains permissions for RLS.
*
*
* By default, FormatVersion
is VERSION_1
. When FormatVersion
is
* VERSION_1
, UserName
and GroupName
are required. When
* FormatVersion
is VERSION_2
, UserARN
and GroupARN
are
* required, and Namespace
must not exist.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #formatVersion}
* will return {@link RowLevelPermissionFormatVersion#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #formatVersionAsString}.
*
*
* @return The user or group rules associated with the dataset that contains permissions for RLS.
*
* By default, FormatVersion
is VERSION_1
. When FormatVersion
is
* VERSION_1
, UserName
and GroupName
are required. When
* FormatVersion
is VERSION_2
, UserARN
and GroupARN
are
* required, and Namespace
must not exist.
* @see RowLevelPermissionFormatVersion
*/
public final String formatVersionAsString() {
return formatVersion;
}
/**
*
* The status of the row-level security permission dataset. If enabled, the status is ENABLED
. If
* disabled, the status is DISABLED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the row-level security permission dataset. If enabled, the status is ENABLED
.
* If disabled, the status is DISABLED
.
* @see Status
*/
public final Status status() {
return Status.fromValue(status);
}
/**
*
* The status of the row-level security permission dataset. If enabled, the status is ENABLED
. If
* disabled, the status is DISABLED
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the row-level security permission dataset. If enabled, the status is ENABLED
.
* If disabled, the status is DISABLED
.
* @see Status
*/
public final String statusAsString() {
return status;
}
@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(namespace());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(permissionPolicyAsString());
hashCode = 31 * hashCode + Objects.hashCode(formatVersionAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
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 RowLevelPermissionDataSet)) {
return false;
}
RowLevelPermissionDataSet other = (RowLevelPermissionDataSet) obj;
return Objects.equals(namespace(), other.namespace()) && Objects.equals(arn(), other.arn())
&& Objects.equals(permissionPolicyAsString(), other.permissionPolicyAsString())
&& Objects.equals(formatVersionAsString(), other.formatVersionAsString())
&& Objects.equals(statusAsString(), other.statusAsString());
}
/**
* 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("RowLevelPermissionDataSet").add("Namespace", namespace()).add("Arn", arn())
.add("PermissionPolicy", permissionPolicyAsString()).add("FormatVersion", formatVersionAsString())
.add("Status", statusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Namespace":
return Optional.ofNullable(clazz.cast(namespace()));
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "PermissionPolicy":
return Optional.ofNullable(clazz.cast(permissionPolicyAsString()));
case "FormatVersion":
return Optional.ofNullable(clazz.cast(formatVersionAsString()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function