/* * Copyright 2010-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.iot.model; import java.io.Serializable; /** *

* Send data to an HTTPS endpoint. *

*/ public class HttpAction implements Serializable { /** *

* The endpoint URL. If substitution templates are used in the URL, you must * also specify a confirmationUrl. If this is a new * destination, a new TopicRuleDestination is created if * possible. *

*

* Constraints:
* Length: - 2000
*/ private String url; /** *

* The URL to which IoT sends a confirmation message. The value of the * confirmation URL must be a prefix of the endpoint URL. If you do not * specify a confirmation URL IoT uses the endpoint URL as the confirmation * URL. If you use substitution templates in the confirmationUrl, you must * create and enable topic rule destinations that match each possible value * of the substitution template before traffic is allowed to your endpoint * URL. *

*

* Constraints:
* Length: - 2000
*/ private String confirmationUrl; /** *

* The HTTP headers to send with the message data. *

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

* The authentication method to use when sending data to an HTTPS endpoint. *

*/ private HttpAuthorization auth; /** *

* The endpoint URL. If substitution templates are used in the URL, you must * also specify a confirmationUrl. If this is a new * destination, a new TopicRuleDestination is created if * possible. *

*

* Constraints:
* Length: - 2000
* * @return

* The endpoint URL. If substitution templates are used in the URL, * you must also specify a confirmationUrl. If this is * a new destination, a new TopicRuleDestination is * created if possible. *

*/ public String getUrl() { return url; } /** *

* The endpoint URL. If substitution templates are used in the URL, you must * also specify a confirmationUrl. If this is a new * destination, a new TopicRuleDestination is created if * possible. *

*

* Constraints:
* Length: - 2000
* * @param url

* The endpoint URL. If substitution templates are used in the * URL, you must also specify a confirmationUrl. If * this is a new destination, a new * TopicRuleDestination is created if possible. *

*/ public void setUrl(String url) { this.url = url; } /** *

* The endpoint URL. If substitution templates are used in the URL, you must * also specify a confirmationUrl. If this is a new * destination, a new TopicRuleDestination is created if * possible. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: - 2000
* * @param url

* The endpoint URL. If substitution templates are used in the * URL, you must also specify a confirmationUrl. If * this is a new destination, a new * TopicRuleDestination is created if possible. *

* @return A reference to this updated object so that method calls can be * chained together. */ public HttpAction withUrl(String url) { this.url = url; return this; } /** *

* The URL to which IoT sends a confirmation message. The value of the * confirmation URL must be a prefix of the endpoint URL. If you do not * specify a confirmation URL IoT uses the endpoint URL as the confirmation * URL. If you use substitution templates in the confirmationUrl, you must * create and enable topic rule destinations that match each possible value * of the substitution template before traffic is allowed to your endpoint * URL. *

*

* Constraints:
* Length: - 2000
* * @return

* The URL to which IoT sends a confirmation message. The value of * the confirmation URL must be a prefix of the endpoint URL. If you * do not specify a confirmation URL IoT uses the endpoint URL as * the confirmation URL. If you use substitution templates in the * confirmationUrl, you must create and enable topic rule * destinations that match each possible value of the substitution * template before traffic is allowed to your endpoint URL. *

*/ public String getConfirmationUrl() { return confirmationUrl; } /** *

* The URL to which IoT sends a confirmation message. The value of the * confirmation URL must be a prefix of the endpoint URL. If you do not * specify a confirmation URL IoT uses the endpoint URL as the confirmation * URL. If you use substitution templates in the confirmationUrl, you must * create and enable topic rule destinations that match each possible value * of the substitution template before traffic is allowed to your endpoint * URL. *

*

* Constraints:
* Length: - 2000
* * @param confirmationUrl

* The URL to which IoT sends a confirmation message. The value * of the confirmation URL must be a prefix of the endpoint URL. * If you do not specify a confirmation URL IoT uses the endpoint * URL as the confirmation URL. If you use substitution templates * in the confirmationUrl, you must create and enable topic rule * destinations that match each possible value of the * substitution template before traffic is allowed to your * endpoint URL. *

*/ public void setConfirmationUrl(String confirmationUrl) { this.confirmationUrl = confirmationUrl; } /** *

* The URL to which IoT sends a confirmation message. The value of the * confirmation URL must be a prefix of the endpoint URL. If you do not * specify a confirmation URL IoT uses the endpoint URL as the confirmation * URL. If you use substitution templates in the confirmationUrl, you must * create and enable topic rule destinations that match each possible value * of the substitution template before traffic is allowed to your endpoint * URL. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: - 2000
* * @param confirmationUrl

* The URL to which IoT sends a confirmation message. The value * of the confirmation URL must be a prefix of the endpoint URL. * If you do not specify a confirmation URL IoT uses the endpoint * URL as the confirmation URL. If you use substitution templates * in the confirmationUrl, you must create and enable topic rule * destinations that match each possible value of the * substitution template before traffic is allowed to your * endpoint URL. *

* @return A reference to this updated object so that method calls can be * chained together. */ public HttpAction withConfirmationUrl(String confirmationUrl) { this.confirmationUrl = confirmationUrl; return this; } /** *

* The HTTP headers to send with the message data. *

* * @return

* The HTTP headers to send with the message data. *

*/ public java.util.List getHeaders() { return headers; } /** *

* The HTTP headers to send with the message data. *

* * @param headers

* The HTTP headers to send with the message data. *

*/ public void setHeaders(java.util.Collection headers) { if (headers == null) { this.headers = null; return; } this.headers = new java.util.ArrayList(headers); } /** *

* The HTTP headers to send with the message data. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param headers

* The HTTP headers to send with the message data. *

* @return A reference to this updated object so that method calls can be * chained together. */ public HttpAction withHeaders(HttpActionHeader... headers) { if (getHeaders() == null) { this.headers = new java.util.ArrayList(headers.length); } for (HttpActionHeader value : headers) { this.headers.add(value); } return this; } /** *

* The HTTP headers to send with the message data. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param headers

* The HTTP headers to send with the message data. *

* @return A reference to this updated object so that method calls can be * chained together. */ public HttpAction withHeaders(java.util.Collection headers) { setHeaders(headers); return this; } /** *

* The authentication method to use when sending data to an HTTPS endpoint. *

* * @return

* The authentication method to use when sending data to an HTTPS * endpoint. *

*/ public HttpAuthorization getAuth() { return auth; } /** *

* The authentication method to use when sending data to an HTTPS endpoint. *

* * @param auth

* The authentication method to use when sending data to an HTTPS * endpoint. *

*/ public void setAuth(HttpAuthorization auth) { this.auth = auth; } /** *

* The authentication method to use when sending data to an HTTPS endpoint. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param auth

* The authentication method to use when sending data to an HTTPS * endpoint. *

* @return A reference to this updated object so that method calls can be * chained together. */ public HttpAction withAuth(HttpAuthorization auth) { this.auth = auth; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getUrl() != null) sb.append("url: " + getUrl() + ","); if (getConfirmationUrl() != null) sb.append("confirmationUrl: " + getConfirmationUrl() + ","); if (getHeaders() != null) sb.append("headers: " + getHeaders() + ","); if (getAuth() != null) sb.append("auth: " + getAuth()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUrl() == null) ? 0 : getUrl().hashCode()); hashCode = prime * hashCode + ((getConfirmationUrl() == null) ? 0 : getConfirmationUrl().hashCode()); hashCode = prime * hashCode + ((getHeaders() == null) ? 0 : getHeaders().hashCode()); hashCode = prime * hashCode + ((getAuth() == null) ? 0 : getAuth().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof HttpAction == false) return false; HttpAction other = (HttpAction) obj; if (other.getUrl() == null ^ this.getUrl() == null) return false; if (other.getUrl() != null && other.getUrl().equals(this.getUrl()) == false) return false; if (other.getConfirmationUrl() == null ^ this.getConfirmationUrl() == null) return false; if (other.getConfirmationUrl() != null && other.getConfirmationUrl().equals(this.getConfirmationUrl()) == false) return false; if (other.getHeaders() == null ^ this.getHeaders() == null) return false; if (other.getHeaders() != null && other.getHeaders().equals(this.getHeaders()) == false) return false; if (other.getAuth() == null ^ this.getAuth() == null) return false; if (other.getAuth() != null && other.getAuth().equals(this.getAuth()) == false) return false; return true; } }