com.amazonaws.services.managedgrafana.model.UpdateInstruction Maven / Gradle / Ivy
Show all versions of aws-java-sdk-managedgrafana Show documentation
/*
* 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.managedgrafana.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains the instructions for one Grafana role permission update in a UpdatePermissions
* operation.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateInstruction implements Serializable, Cloneable, StructuredPojo {
/**
*
* Specifies whether this update is to add or revoke role permissions.
*
*/
private String action;
/**
*
* The role to add or revoke for the user or the group specified in users
.
*
*/
private String role;
/**
*
* A structure that specifies the user or group to add or revoke the role for.
*
*/
private java.util.List users;
/**
*
* Specifies whether this update is to add or revoke role permissions.
*
*
* @param action
* Specifies whether this update is to add or revoke role permissions.
* @see UpdateAction
*/
public void setAction(String action) {
this.action = action;
}
/**
*
* Specifies whether this update is to add or revoke role permissions.
*
*
* @return Specifies whether this update is to add or revoke role permissions.
* @see UpdateAction
*/
public String getAction() {
return this.action;
}
/**
*
* Specifies whether this update is to add or revoke role permissions.
*
*
* @param action
* Specifies whether this update is to add or revoke role permissions.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UpdateAction
*/
public UpdateInstruction withAction(String action) {
setAction(action);
return this;
}
/**
*
* Specifies whether this update is to add or revoke role permissions.
*
*
* @param action
* Specifies whether this update is to add or revoke role permissions.
* @return Returns a reference to this object so that method calls can be chained together.
* @see UpdateAction
*/
public UpdateInstruction withAction(UpdateAction action) {
this.action = action.toString();
return this;
}
/**
*
* The role to add or revoke for the user or the group specified in users
.
*
*
* @param role
* The role to add or revoke for the user or the group specified in users
.
* @see Role
*/
public void setRole(String role) {
this.role = role;
}
/**
*
* The role to add or revoke for the user or the group specified in users
.
*
*
* @return The role to add or revoke for the user or the group specified in users
.
* @see Role
*/
public String getRole() {
return this.role;
}
/**
*
* The role to add or revoke for the user or the group specified in users
.
*
*
* @param role
* The role to add or revoke for the user or the group specified in users
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Role
*/
public UpdateInstruction withRole(String role) {
setRole(role);
return this;
}
/**
*
* The role to add or revoke for the user or the group specified in users
.
*
*
* @param role
* The role to add or revoke for the user or the group specified in users
.
* @return Returns a reference to this object so that method calls can be chained together.
* @see Role
*/
public UpdateInstruction withRole(Role role) {
this.role = role.toString();
return this;
}
/**
*
* A structure that specifies the user or group to add or revoke the role for.
*
*
* @return A structure that specifies the user or group to add or revoke the role for.
*/
public java.util.List getUsers() {
return users;
}
/**
*
* A structure that specifies the user or group to add or revoke the role for.
*
*
* @param users
* A structure that specifies the user or group to add or revoke the role for.
*/
public void setUsers(java.util.Collection users) {
if (users == null) {
this.users = null;
return;
}
this.users = new java.util.ArrayList(users);
}
/**
*
* A structure that specifies the user or group to add or revoke the role for.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setUsers(java.util.Collection)} or {@link #withUsers(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param users
* A structure that specifies the user or group to add or revoke the role for.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateInstruction withUsers(User... users) {
if (this.users == null) {
setUsers(new java.util.ArrayList(users.length));
}
for (User ele : users) {
this.users.add(ele);
}
return this;
}
/**
*
* A structure that specifies the user or group to add or revoke the role for.
*
*
* @param users
* A structure that specifies the user or group to add or revoke the role for.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UpdateInstruction withUsers(java.util.Collection users) {
setUsers(users);
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 (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getRole() != null)
sb.append("Role: ").append(getRole()).append(",");
if (getUsers() != null)
sb.append("Users: ").append(getUsers());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UpdateInstruction == false)
return false;
UpdateInstruction other = (UpdateInstruction) obj;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getRole() == null ^ this.getRole() == null)
return false;
if (other.getRole() != null && other.getRole().equals(this.getRole()) == false)
return false;
if (other.getUsers() == null ^ this.getUsers() == null)
return false;
if (other.getUsers() != null && other.getUsers().equals(this.getUsers()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getRole() == null) ? 0 : getRole().hashCode());
hashCode = prime * hashCode + ((getUsers() == null) ? 0 : getUsers().hashCode());
return hashCode;
}
@Override
public UpdateInstruction clone() {
try {
return (UpdateInstruction) 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.managedgrafana.model.transform.UpdateInstructionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}