software.amazon.awssdk.services.ram.model.GetPermissionRequest 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.ram.model;
import java.beans.Transient;
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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetPermissionRequest extends RamRequest implements
ToCopyableBuilder {
private static final SdkField PERMISSION_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("permissionArn").getter(getter(GetPermissionRequest::permissionArn))
.setter(setter(Builder::permissionArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("permissionArn").build()).build();
private static final SdkField PERMISSION_VERSION_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("permissionVersion").getter(getter(GetPermissionRequest::permissionVersion))
.setter(setter(Builder::permissionVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("permissionVersion").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PERMISSION_ARN_FIELD,
PERMISSION_VERSION_FIELD));
private final String permissionArn;
private final Integer permissionVersion;
private GetPermissionRequest(BuilderImpl builder) {
super(builder);
this.permissionArn = builder.permissionArn;
this.permissionVersion = builder.permissionVersion;
}
/**
*
* Specifies the Amazon Resoure
* Name (ARN) of the permission whose contents you want to retrieve. To find the ARN for a permission, use
* either the ListPermissions operation or go to the Permissions library page in the RAM console and
* then choose the name of the permission. The ARN is displayed on the detail page.
*
*
* @return Specifies the Amazon
* Resoure Name (ARN) of the permission whose contents you want to retrieve. To find the ARN for a
* permission, use either the ListPermissions operation or go to the Permissions library page in the RAM
* console and then choose the name of the permission. The ARN is displayed on the detail page.
*/
public final String permissionArn() {
return permissionArn;
}
/**
*
* Specifies identifier for the version of the RAM permission to retrieve. If you don't specify this parameter, the
* operation retrieves the default version.
*
*
* @return Specifies identifier for the version of the RAM permission to retrieve. If you don't specify this
* parameter, the operation retrieves the default version.
*/
public final Integer permissionVersion() {
return permissionVersion;
}
@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(permissionArn());
hashCode = 31 * hashCode + Objects.hashCode(permissionVersion());
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 GetPermissionRequest)) {
return false;
}
GetPermissionRequest other = (GetPermissionRequest) obj;
return Objects.equals(permissionArn(), other.permissionArn())
&& Objects.equals(permissionVersion(), other.permissionVersion());
}
/**
* 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("GetPermissionRequest").add("PermissionArn", permissionArn())
.add("PermissionVersion", permissionVersion()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "permissionArn":
return Optional.ofNullable(clazz.cast(permissionArn()));
case "permissionVersion":
return Optional.ofNullable(clazz.cast(permissionVersion()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy