
com.amazonaws.services.apigateway.model.PatchOperation Maven / Gradle / Ivy
/*
* 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.apigateway.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* For more information about supported patch operations, see Patch Operations.
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PatchOperation implements Serializable, Cloneable, StructuredPojo {
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*/
private String op;
/**
*
* The op operation's target, as identified by a JSON Pointer value that references a location within the targeted
* resource. For example, if the target resource has an updateable property of {"name":"value"}, the path for this
* property is /name. If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}}),
* the path for the child/name property will be /name/child~1name. Any slash ("/") character appearing in path names
* must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated
* with it.
*
*/
private String path;
/**
*
* The new target value of the update operation. It is applicable for the add or replace operation. When using AWS
* CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell,
* e.g., '{"a": ...}'.
*
*/
private String value;
/**
*
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within the
* targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary
* deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy",
* "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*
*/
private String from;
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*
* @param op
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace
* or copy. Not all valid operations are supported for a given resource. Support of the operations depends on
* specific operational contexts. Attempts to apply an unsupported operation on a resource will return an
* error message..
* @see Op
*/
public void setOp(String op) {
this.op = op;
}
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*
* @return An update operation to be performed with this PATCH request. The valid value can be add, remove, replace
* or copy. Not all valid operations are supported for a given resource. Support of the operations depends
* on specific operational contexts. Attempts to apply an unsupported operation on a resource will return an
* error message..
* @see Op
*/
public String getOp() {
return this.op;
}
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*
* @param op
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace
* or copy. Not all valid operations are supported for a given resource. Support of the operations depends on
* specific operational contexts. Attempts to apply an unsupported operation on a resource will return an
* error message..
* @return Returns a reference to this object so that method calls can be chained together.
* @see Op
*/
public PatchOperation withOp(String op) {
setOp(op);
return this;
}
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*
* @param op
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace
* or copy. Not all valid operations are supported for a given resource. Support of the operations depends on
* specific operational contexts. Attempts to apply an unsupported operation on a resource will return an
* error message..
* @see Op
*/
public void setOp(Op op) {
withOp(op);
}
/**
*
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy.
* Not all valid operations are supported for a given resource. Support of the operations depends on specific
* operational contexts. Attempts to apply an unsupported operation on a resource will return an error message..
*
*
* @param op
* An update operation to be performed with this PATCH request. The valid value can be add, remove, replace
* or copy. Not all valid operations are supported for a given resource. Support of the operations depends on
* specific operational contexts. Attempts to apply an unsupported operation on a resource will return an
* error message..
* @return Returns a reference to this object so that method calls can be chained together.
* @see Op
*/
public PatchOperation withOp(Op op) {
this.op = op.toString();
return this;
}
/**
*
* The op operation's target, as identified by a JSON Pointer value that references a location within the targeted
* resource. For example, if the target resource has an updateable property of {"name":"value"}, the path for this
* property is /name. If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}}),
* the path for the child/name property will be /name/child~1name. Any slash ("/") character appearing in path names
* must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated
* with it.
*
*
* @param path
* The op operation's target, as identified by a JSON Pointer value that references a location within the
* targeted resource. For example, if the target resource has an updateable property of {"name":"value"}, the
* path for this property is /name. If the name property value is a JSON object (e.g., {"name":
* {"child/name": "child-value"}}), the path for the child/name property will be /name/child~1name. Any slash
* ("/") character appearing in path names must be escaped with "~1", as shown in the example above. Each op
* operation can have only one path associated with it.
*/
public void setPath(String path) {
this.path = path;
}
/**
*
* The op operation's target, as identified by a JSON Pointer value that references a location within the targeted
* resource. For example, if the target resource has an updateable property of {"name":"value"}, the path for this
* property is /name. If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}}),
* the path for the child/name property will be /name/child~1name. Any slash ("/") character appearing in path names
* must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated
* with it.
*
*
* @return The op operation's target, as identified by a JSON Pointer value that references a location within the
* targeted resource. For example, if the target resource has an updateable property of {"name":"value"},
* the path for this property is /name. If the name property value is a JSON object (e.g., {"name":
* {"child/name": "child-value"}}), the path for the child/name property will be /name/child~1name. Any
* slash ("/") character appearing in path names must be escaped with "~1", as shown in the example above.
* Each op operation can have only one path associated with it.
*/
public String getPath() {
return this.path;
}
/**
*
* The op operation's target, as identified by a JSON Pointer value that references a location within the targeted
* resource. For example, if the target resource has an updateable property of {"name":"value"}, the path for this
* property is /name. If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}}),
* the path for the child/name property will be /name/child~1name. Any slash ("/") character appearing in path names
* must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated
* with it.
*
*
* @param path
* The op operation's target, as identified by a JSON Pointer value that references a location within the
* targeted resource. For example, if the target resource has an updateable property of {"name":"value"}, the
* path for this property is /name. If the name property value is a JSON object (e.g., {"name":
* {"child/name": "child-value"}}), the path for the child/name property will be /name/child~1name. Any slash
* ("/") character appearing in path names must be escaped with "~1", as shown in the example above. Each op
* operation can have only one path associated with it.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PatchOperation withPath(String path) {
setPath(path);
return this;
}
/**
*
* The new target value of the update operation. It is applicable for the add or replace operation. When using AWS
* CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell,
* e.g., '{"a": ...}'.
*
*
* @param value
* The new target value of the update operation. It is applicable for the add or replace operation. When
* using AWS CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes
* in a Linux shell, e.g., '{"a": ...}'.
*/
public void setValue(String value) {
this.value = value;
}
/**
*
* The new target value of the update operation. It is applicable for the add or replace operation. When using AWS
* CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell,
* e.g., '{"a": ...}'.
*
*
* @return The new target value of the update operation. It is applicable for the add or replace operation. When
* using AWS CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes
* in a Linux shell, e.g., '{"a": ...}'.
*/
public String getValue() {
return this.value;
}
/**
*
* The new target value of the update operation. It is applicable for the add or replace operation. When using AWS
* CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell,
* e.g., '{"a": ...}'.
*
*
* @param value
* The new target value of the update operation. It is applicable for the add or replace operation. When
* using AWS CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes
* in a Linux shell, e.g., '{"a": ...}'.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PatchOperation withValue(String value) {
setValue(value);
return this;
}
/**
*
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within the
* targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary
* deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy",
* "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*
*
* @param from
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within
* the targeted resource to copy the value from. For example, to promote a canary deployment, you copy the
* canary deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with
* "op":"copy", "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*/
public void setFrom(String from) {
this.from = from;
}
/**
*
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within the
* targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary
* deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy",
* "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*
*
* @return The copy update operation's source as identified by a JSON-Pointer value referencing the location within
* the targeted resource to copy the value from. For example, to promote a canary deployment, you copy the
* canary deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with
* "op":"copy", "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*/
public String getFrom() {
return this.from;
}
/**
*
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within the
* targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary
* deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy",
* "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
*
*
* @param from
* The copy update operation's source as identified by a JSON-Pointer value referencing the location within
* the targeted resource to copy the value from. For example, to promote a canary deployment, you copy the
* canary deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with
* "op":"copy", "from":"/canarySettings/deploymentId" and "path":"/deploymentId".
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PatchOperation withFrom(String from) {
setFrom(from);
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 (getOp() != null)
sb.append("Op: ").append(getOp()).append(",");
if (getPath() != null)
sb.append("Path: ").append(getPath()).append(",");
if (getValue() != null)
sb.append("Value: ").append(getValue()).append(",");
if (getFrom() != null)
sb.append("From: ").append(getFrom());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PatchOperation == false)
return false;
PatchOperation other = (PatchOperation) obj;
if (other.getOp() == null ^ this.getOp() == null)
return false;
if (other.getOp() != null && other.getOp().equals(this.getOp()) == false)
return false;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getValue() == null ^ this.getValue() == null)
return false;
if (other.getValue() != null && other.getValue().equals(this.getValue()) == false)
return false;
if (other.getFrom() == null ^ this.getFrom() == null)
return false;
if (other.getFrom() != null && other.getFrom().equals(this.getFrom()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getOp() == null) ? 0 : getOp().hashCode());
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode + ((getValue() == null) ? 0 : getValue().hashCode());
hashCode = prime * hashCode + ((getFrom() == null) ? 0 : getFrom().hashCode());
return hashCode;
}
@Override
public PatchOperation clone() {
try {
return (PatchOperation) 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.apigateway.model.transform.PatchOperationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}