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.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.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 static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("permissionArn", PERMISSION_ARN_FIELD);
put("permissionVersion", 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
* Resource 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
* Resource 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 the version number of the RAM permission to retrieve. If you don't specify this parameter, the
* operation retrieves the default version.
*
*
* To see the list of available versions, use ListPermissionVersions.
*
*
* @return Specifies the version number of the RAM permission to retrieve. If you don't specify this parameter, the
* operation retrieves the default version.
*
* To see the list of available versions, use ListPermissionVersions.
*/
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;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function
*
* To see the list of available versions, use ListPermissionVersions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder permissionVersion(Integer permissionVersion);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends RamRequest.BuilderImpl implements Builder {
private String permissionArn;
private Integer permissionVersion;
private BuilderImpl() {
}
private BuilderImpl(GetPermissionRequest model) {
super(model);
permissionArn(model.permissionArn);
permissionVersion(model.permissionVersion);
}
public final String getPermissionArn() {
return permissionArn;
}
public final void setPermissionArn(String permissionArn) {
this.permissionArn = permissionArn;
}
@Override
public final Builder permissionArn(String permissionArn) {
this.permissionArn = permissionArn;
return this;
}
public final Integer getPermissionVersion() {
return permissionVersion;
}
public final void setPermissionVersion(Integer permissionVersion) {
this.permissionVersion = permissionVersion;
}
@Override
public final Builder permissionVersion(Integer permissionVersion) {
this.permissionVersion = permissionVersion;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public GetPermissionRequest build() {
return new GetPermissionRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}