com.amazonaws.services.ivsrealtime.model.ParticipantToken Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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.ivsrealtime.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Object specifying a participant token in a stage.
*
*
* Important: Treat tokens as opaque; i.e., do not build functionality based on token contents. The format of
* tokens could change in the future.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ParticipantToken implements Serializable, Cloneable, StructuredPojo {
/**
*
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed to all
* stage participants and should not be used for personally identifying, confidential, or sensitive information.
*
*/
private java.util.Map attributes;
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*/
private java.util.List capabilities;
/**
*
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*
*/
private Integer duration;
/**
*
* ISO 8601 timestamp (returned as a string) for when this token expires.
*
*/
private java.util.Date expirationTime;
/**
*
* Unique identifier for this participant token, assigned by IVS.
*
*/
private String participantId;
/**
*
* The issued client token, encrypted.
*
*/
private String token;
/**
*
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage participants
* and should not be used for personally identifying, confidential, or sensitive information.
*
*/
private String userId;
/**
*
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed to all
* stage participants and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @return Application-provided attributes to encode into the token and attach to a stage. This field is exposed
* to all stage participants and should not be used for personally identifying, confidential, or sensitive
* information.
*/
public java.util.Map getAttributes() {
return attributes;
}
/**
*
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed to all
* stage participants and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @param attributes
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed
* to all stage participants and should not be used for personally identifying, confidential, or sensitive
* information.
*/
public void setAttributes(java.util.Map attributes) {
this.attributes = attributes;
}
/**
*
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed to all
* stage participants and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @param attributes
* Application-provided attributes to encode into the token and attach to a stage. This field is exposed
* to all stage participants and should not be used for personally identifying, confidential, or sensitive
* information.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withAttributes(java.util.Map attributes) {
setAttributes(attributes);
return this;
}
/**
* Add a single Attributes entry
*
* @see ParticipantToken#withAttributes
* @returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken addAttributesEntry(String key, String value) {
if (null == this.attributes) {
this.attributes = new java.util.HashMap();
}
if (this.attributes.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.attributes.put(key, value);
return this;
}
/**
* Removes all the entries added into Attributes.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken clearAttributesEntries() {
this.attributes = null;
return this;
}
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*
* @return Set of capabilities that the user is allowed to perform in the stage.
* @see ParticipantTokenCapability
*/
public java.util.List getCapabilities() {
return capabilities;
}
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*
* @param capabilities
* Set of capabilities that the user is allowed to perform in the stage.
* @see ParticipantTokenCapability
*/
public void setCapabilities(java.util.Collection capabilities) {
if (capabilities == null) {
this.capabilities = null;
return;
}
this.capabilities = new java.util.ArrayList(capabilities);
}
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setCapabilities(java.util.Collection)} or {@link #withCapabilities(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param capabilities
* Set of capabilities that the user is allowed to perform in the stage.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ParticipantTokenCapability
*/
public ParticipantToken withCapabilities(String... capabilities) {
if (this.capabilities == null) {
setCapabilities(new java.util.ArrayList(capabilities.length));
}
for (String ele : capabilities) {
this.capabilities.add(ele);
}
return this;
}
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*
* @param capabilities
* Set of capabilities that the user is allowed to perform in the stage.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ParticipantTokenCapability
*/
public ParticipantToken withCapabilities(java.util.Collection capabilities) {
setCapabilities(capabilities);
return this;
}
/**
*
* Set of capabilities that the user is allowed to perform in the stage.
*
*
* @param capabilities
* Set of capabilities that the user is allowed to perform in the stage.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ParticipantTokenCapability
*/
public ParticipantToken withCapabilities(ParticipantTokenCapability... capabilities) {
java.util.ArrayList capabilitiesCopy = new java.util.ArrayList(capabilities.length);
for (ParticipantTokenCapability value : capabilities) {
capabilitiesCopy.add(value.toString());
}
if (getCapabilities() == null) {
setCapabilities(capabilitiesCopy);
} else {
getCapabilities().addAll(capabilitiesCopy);
}
return this;
}
/**
*
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*
*
* @param duration
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*/
public void setDuration(Integer duration) {
this.duration = duration;
}
/**
*
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*
*
* @return Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*/
public Integer getDuration() {
return this.duration;
}
/**
*
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
*
*
* @param duration
* Duration (in minutes), after which the participant token expires. Default: 720 (12 hours).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withDuration(Integer duration) {
setDuration(duration);
return this;
}
/**
*
* ISO 8601 timestamp (returned as a string) for when this token expires.
*
*
* @param expirationTime
* ISO 8601 timestamp (returned as a string) for when this token expires.
*/
public void setExpirationTime(java.util.Date expirationTime) {
this.expirationTime = expirationTime;
}
/**
*
* ISO 8601 timestamp (returned as a string) for when this token expires.
*
*
* @return ISO 8601 timestamp (returned as a string) for when this token expires.
*/
public java.util.Date getExpirationTime() {
return this.expirationTime;
}
/**
*
* ISO 8601 timestamp (returned as a string) for when this token expires.
*
*
* @param expirationTime
* ISO 8601 timestamp (returned as a string) for when this token expires.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withExpirationTime(java.util.Date expirationTime) {
setExpirationTime(expirationTime);
return this;
}
/**
*
* Unique identifier for this participant token, assigned by IVS.
*
*
* @param participantId
* Unique identifier for this participant token, assigned by IVS.
*/
public void setParticipantId(String participantId) {
this.participantId = participantId;
}
/**
*
* Unique identifier for this participant token, assigned by IVS.
*
*
* @return Unique identifier for this participant token, assigned by IVS.
*/
public String getParticipantId() {
return this.participantId;
}
/**
*
* Unique identifier for this participant token, assigned by IVS.
*
*
* @param participantId
* Unique identifier for this participant token, assigned by IVS.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withParticipantId(String participantId) {
setParticipantId(participantId);
return this;
}
/**
*
* The issued client token, encrypted.
*
*
* @param token
* The issued client token, encrypted.
*/
public void setToken(String token) {
this.token = token;
}
/**
*
* The issued client token, encrypted.
*
*
* @return The issued client token, encrypted.
*/
public String getToken() {
return this.token;
}
/**
*
* The issued client token, encrypted.
*
*
* @param token
* The issued client token, encrypted.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withToken(String token) {
setToken(token);
return this;
}
/**
*
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage participants
* and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @param userId
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage
* participants and should not be used for personally identifying, confidential, or sensitive
* information.
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
*
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage participants
* and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @return Customer-assigned name to help identify the token; this can be used to link a participant to a user in
* the customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage
* participants and should not be used for personally identifying, confidential, or sensitive
* information.
*/
public String getUserId() {
return this.userId;
}
/**
*
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage participants
* and should not be used for personally identifying, confidential, or sensitive information.
*
*
* @param userId
* Customer-assigned name to help identify the token; this can be used to link a participant to a user in the
* customer’s own systems. This can be any UTF-8 encoded text. This field is exposed to all stage
* participants and should not be used for personally identifying, confidential, or sensitive
* information.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ParticipantToken withUserId(String userId) {
setUserId(userId);
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 (getAttributes() != null)
sb.append("Attributes: ").append(getAttributes()).append(",");
if (getCapabilities() != null)
sb.append("Capabilities: ").append(getCapabilities()).append(",");
if (getDuration() != null)
sb.append("Duration: ").append(getDuration()).append(",");
if (getExpirationTime() != null)
sb.append("ExpirationTime: ").append(getExpirationTime()).append(",");
if (getParticipantId() != null)
sb.append("ParticipantId: ").append(getParticipantId()).append(",");
if (getToken() != null)
sb.append("Token: ").append("***Sensitive Data Redacted***").append(",");
if (getUserId() != null)
sb.append("UserId: ").append(getUserId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ParticipantToken == false)
return false;
ParticipantToken other = (ParticipantToken) obj;
if (other.getAttributes() == null ^ this.getAttributes() == null)
return false;
if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false)
return false;
if (other.getCapabilities() == null ^ this.getCapabilities() == null)
return false;
if (other.getCapabilities() != null && other.getCapabilities().equals(this.getCapabilities()) == false)
return false;
if (other.getDuration() == null ^ this.getDuration() == null)
return false;
if (other.getDuration() != null && other.getDuration().equals(this.getDuration()) == false)
return false;
if (other.getExpirationTime() == null ^ this.getExpirationTime() == null)
return false;
if (other.getExpirationTime() != null && other.getExpirationTime().equals(this.getExpirationTime()) == false)
return false;
if (other.getParticipantId() == null ^ this.getParticipantId() == null)
return false;
if (other.getParticipantId() != null && other.getParticipantId().equals(this.getParticipantId()) == false)
return false;
if (other.getToken() == null ^ this.getToken() == null)
return false;
if (other.getToken() != null && other.getToken().equals(this.getToken()) == false)
return false;
if (other.getUserId() == null ^ this.getUserId() == null)
return false;
if (other.getUserId() != null && other.getUserId().equals(this.getUserId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode());
hashCode = prime * hashCode + ((getCapabilities() == null) ? 0 : getCapabilities().hashCode());
hashCode = prime * hashCode + ((getDuration() == null) ? 0 : getDuration().hashCode());
hashCode = prime * hashCode + ((getExpirationTime() == null) ? 0 : getExpirationTime().hashCode());
hashCode = prime * hashCode + ((getParticipantId() == null) ? 0 : getParticipantId().hashCode());
hashCode = prime * hashCode + ((getToken() == null) ? 0 : getToken().hashCode());
hashCode = prime * hashCode + ((getUserId() == null) ? 0 : getUserId().hashCode());
return hashCode;
}
@Override
public ParticipantToken clone() {
try {
return (ParticipantToken) 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.ivsrealtime.model.transform.ParticipantTokenMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}