/* * Copyright 2018-2023 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 com.amazonaws.services.licensemanager.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Describes a grant. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Grant implements Serializable, Cloneable, StructuredPojo { /** *

* Amazon Resource Name (ARN) of the grant. *

*/ private String grantArn; /** *

* Grant name. *

*/ private String grantName; /** *

* Parent ARN. *

*/ private String parentArn; /** *

* License ARN. *

*/ private String licenseArn; /** *

* The grantee principal ARN. *

*/ private String granteePrincipalArn; /** *

* Home Region of the grant. *

*/ private String homeRegion; /** *

* Grant status. *

*/ private String grantStatus; /** *

* Grant status reason. *

*/ private String statusReason; /** *

* Grant version. *

*/ private String version; /** *

* Granted operations. *

*/ private java.util.List grantedOperations; /** *

* The options specified for the grant. *

*/ private Options options; /** *

* Amazon Resource Name (ARN) of the grant. *

* * @param grantArn * Amazon Resource Name (ARN) of the grant. */ public void setGrantArn(String grantArn) { this.grantArn = grantArn; } /** *

* Amazon Resource Name (ARN) of the grant. *

* * @return Amazon Resource Name (ARN) of the grant. */ public String getGrantArn() { return this.grantArn; } /** *

* Amazon Resource Name (ARN) of the grant. *

* * @param grantArn * Amazon Resource Name (ARN) of the grant. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withGrantArn(String grantArn) { setGrantArn(grantArn); return this; } /** *

* Grant name. *

* * @param grantName * Grant name. */ public void setGrantName(String grantName) { this.grantName = grantName; } /** *

* Grant name. *

* * @return Grant name. */ public String getGrantName() { return this.grantName; } /** *

* Grant name. *

* * @param grantName * Grant name. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withGrantName(String grantName) { setGrantName(grantName); return this; } /** *

* Parent ARN. *

* * @param parentArn * Parent ARN. */ public void setParentArn(String parentArn) { this.parentArn = parentArn; } /** *

* Parent ARN. *

* * @return Parent ARN. */ public String getParentArn() { return this.parentArn; } /** *

* Parent ARN. *

* * @param parentArn * Parent ARN. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withParentArn(String parentArn) { setParentArn(parentArn); return this; } /** *

* License ARN. *

* * @param licenseArn * License ARN. */ public void setLicenseArn(String licenseArn) { this.licenseArn = licenseArn; } /** *

* License ARN. *

* * @return License ARN. */ public String getLicenseArn() { return this.licenseArn; } /** *

* License ARN. *

* * @param licenseArn * License ARN. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withLicenseArn(String licenseArn) { setLicenseArn(licenseArn); return this; } /** *

* The grantee principal ARN. *

* * @param granteePrincipalArn * The grantee principal ARN. */ public void setGranteePrincipalArn(String granteePrincipalArn) { this.granteePrincipalArn = granteePrincipalArn; } /** *

* The grantee principal ARN. *

* * @return The grantee principal ARN. */ public String getGranteePrincipalArn() { return this.granteePrincipalArn; } /** *

* The grantee principal ARN. *

* * @param granteePrincipalArn * The grantee principal ARN. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withGranteePrincipalArn(String granteePrincipalArn) { setGranteePrincipalArn(granteePrincipalArn); return this; } /** *

* Home Region of the grant. *

* * @param homeRegion * Home Region of the grant. */ public void setHomeRegion(String homeRegion) { this.homeRegion = homeRegion; } /** *

* Home Region of the grant. *

* * @return Home Region of the grant. */ public String getHomeRegion() { return this.homeRegion; } /** *

* Home Region of the grant. *

* * @param homeRegion * Home Region of the grant. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withHomeRegion(String homeRegion) { setHomeRegion(homeRegion); return this; } /** *

* Grant status. *

* * @param grantStatus * Grant status. * @see GrantStatus */ public void setGrantStatus(String grantStatus) { this.grantStatus = grantStatus; } /** *

* Grant status. *

* * @return Grant status. * @see GrantStatus */ public String getGrantStatus() { return this.grantStatus; } /** *

* Grant status. *

* * @param grantStatus * Grant status. * @return Returns a reference to this object so that method calls can be chained together. * @see GrantStatus */ public Grant withGrantStatus(String grantStatus) { setGrantStatus(grantStatus); return this; } /** *

* Grant status. *

* * @param grantStatus * Grant status. * @return Returns a reference to this object so that method calls can be chained together. * @see GrantStatus */ public Grant withGrantStatus(GrantStatus grantStatus) { this.grantStatus = grantStatus.toString(); return this; } /** *

* Grant status reason. *

* * @param statusReason * Grant status reason. */ public void setStatusReason(String statusReason) { this.statusReason = statusReason; } /** *

* Grant status reason. *

* * @return Grant status reason. */ public String getStatusReason() { return this.statusReason; } /** *

* Grant status reason. *

* * @param statusReason * Grant status reason. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withStatusReason(String statusReason) { setStatusReason(statusReason); return this; } /** *

* Grant version. *

* * @param version * Grant version. */ public void setVersion(String version) { this.version = version; } /** *

* Grant version. *

* * @return Grant version. */ public String getVersion() { return this.version; } /** *

* Grant version. *

* * @param version * Grant version. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withVersion(String version) { setVersion(version); return this; } /** *

* Granted operations. *

* * @return Granted operations. * @see AllowedOperation */ public java.util.List getGrantedOperations() { return grantedOperations; } /** *

* Granted operations. *

* * @param grantedOperations * Granted operations. * @see AllowedOperation */ public void setGrantedOperations(java.util.Collection grantedOperations) { if (grantedOperations == null) { this.grantedOperations = null; return; } this.grantedOperations = new java.util.ArrayList(grantedOperations); } /** *

* Granted operations. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setGrantedOperations(java.util.Collection)} or {@link #withGrantedOperations(java.util.Collection)} if * you want to override the existing values. *

* * @param grantedOperations * Granted operations. * @return Returns a reference to this object so that method calls can be chained together. * @see AllowedOperation */ public Grant withGrantedOperations(String... grantedOperations) { if (this.grantedOperations == null) { setGrantedOperations(new java.util.ArrayList(grantedOperations.length)); } for (String ele : grantedOperations) { this.grantedOperations.add(ele); } return this; } /** *

* Granted operations. *

* * @param grantedOperations * Granted operations. * @return Returns a reference to this object so that method calls can be chained together. * @see AllowedOperation */ public Grant withGrantedOperations(java.util.Collection grantedOperations) { setGrantedOperations(grantedOperations); return this; } /** *

* Granted operations. *

* * @param grantedOperations * Granted operations. * @return Returns a reference to this object so that method calls can be chained together. * @see AllowedOperation */ public Grant withGrantedOperations(AllowedOperation... grantedOperations) { java.util.ArrayList grantedOperationsCopy = new java.util.ArrayList(grantedOperations.length); for (AllowedOperation value : grantedOperations) { grantedOperationsCopy.add(value.toString()); } if (getGrantedOperations() == null) { setGrantedOperations(grantedOperationsCopy); } else { getGrantedOperations().addAll(grantedOperationsCopy); } return this; } /** *

* The options specified for the grant. *

* * @param options * The options specified for the grant. */ public void setOptions(Options options) { this.options = options; } /** *

* The options specified for the grant. *

* * @return The options specified for the grant. */ public Options getOptions() { return this.options; } /** *

* The options specified for the grant. *

* * @param options * The options specified for the grant. * @return Returns a reference to this object so that method calls can be chained together. */ public Grant withOptions(Options options) { setOptions(options); return this; } /** * 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. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getGrantArn() != null) sb.append("GrantArn: ").append(getGrantArn()).append(","); if (getGrantName() != null) sb.append("GrantName: ").append(getGrantName()).append(","); if (getParentArn() != null) sb.append("ParentArn: ").append(getParentArn()).append(","); if (getLicenseArn() != null) sb.append("LicenseArn: ").append(getLicenseArn()).append(","); if (getGranteePrincipalArn() != null) sb.append("GranteePrincipalArn: ").append(getGranteePrincipalArn()).append(","); if (getHomeRegion() != null) sb.append("HomeRegion: ").append(getHomeRegion()).append(","); if (getGrantStatus() != null) sb.append("GrantStatus: ").append(getGrantStatus()).append(","); if (getStatusReason() != null) sb.append("StatusReason: ").append(getStatusReason()).append(","); if (getVersion() != null) sb.append("Version: ").append(getVersion()).append(","); if (getGrantedOperations() != null) sb.append("GrantedOperations: ").append(getGrantedOperations()).append(","); if (getOptions() != null) sb.append("Options: ").append(getOptions()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Grant == false) return false; Grant other = (Grant) obj; if (other.getGrantArn() == null ^ this.getGrantArn() == null) return false; if (other.getGrantArn() != null && other.getGrantArn().equals(this.getGrantArn()) == false) return false; if (other.getGrantName() == null ^ this.getGrantName() == null) return false; if (other.getGrantName() != null && other.getGrantName().equals(this.getGrantName()) == false) return false; if (other.getParentArn() == null ^ this.getParentArn() == null) return false; if (other.getParentArn() != null && other.getParentArn().equals(this.getParentArn()) == false) return false; if (other.getLicenseArn() == null ^ this.getLicenseArn() == null) return false; if (other.getLicenseArn() != null && other.getLicenseArn().equals(this.getLicenseArn()) == false) return false; if (other.getGranteePrincipalArn() == null ^ this.getGranteePrincipalArn() == null) return false; if (other.getGranteePrincipalArn() != null && other.getGranteePrincipalArn().equals(this.getGranteePrincipalArn()) == false) return false; if (other.getHomeRegion() == null ^ this.getHomeRegion() == null) return false; if (other.getHomeRegion() != null && other.getHomeRegion().equals(this.getHomeRegion()) == false) return false; if (other.getGrantStatus() == null ^ this.getGrantStatus() == null) return false; if (other.getGrantStatus() != null && other.getGrantStatus().equals(this.getGrantStatus()) == false) return false; if (other.getStatusReason() == null ^ this.getStatusReason() == null) return false; if (other.getStatusReason() != null && other.getStatusReason().equals(this.getStatusReason()) == false) return false; if (other.getVersion() == null ^ this.getVersion() == null) return false; if (other.getVersion() != null && other.getVersion().equals(this.getVersion()) == false) return false; if (other.getGrantedOperations() == null ^ this.getGrantedOperations() == null) return false; if (other.getGrantedOperations() != null && other.getGrantedOperations().equals(this.getGrantedOperations()) == false) return false; if (other.getOptions() == null ^ this.getOptions() == null) return false; if (other.getOptions() != null && other.getOptions().equals(this.getOptions()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getGrantArn() == null) ? 0 : getGrantArn().hashCode()); hashCode = prime * hashCode + ((getGrantName() == null) ? 0 : getGrantName().hashCode()); hashCode = prime * hashCode + ((getParentArn() == null) ? 0 : getParentArn().hashCode()); hashCode = prime * hashCode + ((getLicenseArn() == null) ? 0 : getLicenseArn().hashCode()); hashCode = prime * hashCode + ((getGranteePrincipalArn() == null) ? 0 : getGranteePrincipalArn().hashCode()); hashCode = prime * hashCode + ((getHomeRegion() == null) ? 0 : getHomeRegion().hashCode()); hashCode = prime * hashCode + ((getGrantStatus() == null) ? 0 : getGrantStatus().hashCode()); hashCode = prime * hashCode + ((getStatusReason() == null) ? 0 : getStatusReason().hashCode()); hashCode = prime * hashCode + ((getVersion() == null) ? 0 : getVersion().hashCode()); hashCode = prime * hashCode + ((getGrantedOperations() == null) ? 0 : getGrantedOperations().hashCode()); hashCode = prime * hashCode + ((getOptions() == null) ? 0 : getOptions().hashCode()); return hashCode; } @Override public Grant clone() { try { return (Grant) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.licensemanager.model.transform.GrantMarshaller.getInstance().marshall(this, protocolMarshaller); } }