/* * 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; import com.amazonaws.AmazonWebServiceRequest; /** *
* Use this API to define a Custom Metric published by your devices to Device * Defender. *
** Requires permission to access the CreateCustomMetric action. *
*/ public class CreateCustomMetricRequest extends AmazonWebServiceRequest implements Serializable { /** *
* The name of the custom metric. This will be used in the metric report
* submitted from the device/thing. The name can't begin with
* aws:
. You can't change the name after you define it.
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*/
private String metricName;
/**
*
* The friendly name in the console for the custom metric. This name doesn't * have to be unique. Don't use this name as the metric identifier in the * device metric report. You can update the friendly name after you define * it. *
*
* Constraints:
* Length: - 128
* Pattern: [\p{Graph}\x20]*
*/
private String displayName;
/**
*
* The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*/
private String metricType;
/**
*
* Metadata that can be used to manage the custom metric. *
*/ private java.util.List* Each custom metric must have a unique client request token. If you try to * create a new custom metric that already exists with a different token, an * exception occurs. If you omit this value, Amazon Web Services SDKs will * automatically generate a unique client request. *
*
* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
*/
private String clientRequestToken;
/**
*
* The name of the custom metric. This will be used in the metric report
* submitted from the device/thing. The name can't begin with
* aws:
. You can't change the name after you define it.
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @return
* The name of the custom metric. This will be used in the metric
* report submitted from the device/thing. The name can't begin with
* aws:
. You can't change the name after you define it.
*
* The name of the custom metric. This will be used in the metric report
* submitted from the device/thing. The name can't begin with
* aws:
. You can't change the name after you define it.
*
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @param metricName
* The name of the custom metric. This will be used in the metric
* report submitted from the device/thing. The name can't begin
* with aws:
. You can't change the name after you
* define it.
*
* The name of the custom metric. This will be used in the metric report
* submitted from the device/thing. The name can't begin with
* aws:
. You can't change the name after you define it.
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 128
* Pattern: [a-zA-Z0-9:_-]+
*
* @param metricName
* The name of the custom metric. This will be used in the metric
* report submitted from the device/thing. The name can't begin
* with aws:
. You can't change the name after you
* define it.
*
* The friendly name in the console for the custom metric. This name doesn't * have to be unique. Don't use this name as the metric identifier in the * device metric report. You can update the friendly name after you define * it. *
*
* Constraints:
* Length: - 128
* Pattern: [\p{Graph}\x20]*
*
* @return
* The friendly name in the console for the custom metric. This name * doesn't have to be unique. Don't use this name as the metric * identifier in the device metric report. You can update the * friendly name after you define it. *
*/ public String getDisplayName() { return displayName; } /** ** The friendly name in the console for the custom metric. This name doesn't * have to be unique. Don't use this name as the metric identifier in the * device metric report. You can update the friendly name after you define * it. *
*
* Constraints:
* Length: - 128
* Pattern: [\p{Graph}\x20]*
*
* @param displayName
* The friendly name in the console for the custom metric. This * name doesn't have to be unique. Don't use this name as the * metric identifier in the device metric report. You can update * the friendly name after you define it. *
*/ public void setDisplayName(String displayName) { this.displayName = displayName; } /** ** The friendly name in the console for the custom metric. This name doesn't * have to be unique. Don't use this name as the metric identifier in the * device metric report. You can update the friendly name after you define * it. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: - 128
* Pattern: [\p{Graph}\x20]*
*
* @param displayName
* The friendly name in the console for the custom metric. This * name doesn't have to be unique. Don't use this name as the * metric identifier in the device metric report. You can update * the friendly name after you define it. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateCustomMetricRequest withDisplayName(String displayName) { this.displayName = displayName; return this; } /** ** The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*
* @return
* The type of the custom metric. *
*
* The type number
only takes a single metric value as
* an input, but when you submit the metrics value in the
* DeviceMetrics report, you must pass it as an array with a single
* value.
*
* The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*
* @param metricType
* The type of the custom metric. *
*
* The type number
only takes a single metric value
* as an input, but when you submit the metrics value in the
* DeviceMetrics report, you must pass it as an array with a
* single value.
*
* The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*
* @param metricType
* The type of the custom metric. *
*
* The type number
only takes a single metric value
* as an input, but when you submit the metrics value in the
* DeviceMetrics report, you must pass it as an array with a
* single value.
*
* The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*
* @param metricType
* The type of the custom metric. *
*
* The type number
only takes a single metric value
* as an input, but when you submit the metrics value in the
* DeviceMetrics report, you must pass it as an array with a
* single value.
*
* The type of the custom metric. *
*
* The type number
only takes a single metric value as an
* input, but when you submit the metrics value in the DeviceMetrics report,
* you must pass it as an array with a single value.
*
* Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: string-list, ip-address-list, number-list, number
*
* @param metricType
* The type of the custom metric. *
*
* The type number
only takes a single metric value
* as an input, but when you submit the metrics value in the
* DeviceMetrics report, you must pass it as an array with a
* single value.
*
* Metadata that can be used to manage the custom metric. *
* * @return* Metadata that can be used to manage the custom metric. *
*/ public java.util.List* Metadata that can be used to manage the custom metric. *
* * @param tags* Metadata that can be used to manage the custom metric. *
*/ public void setTags(java.util.Collection* Metadata that can be used to manage the custom metric. *
** Returns a reference to this object so that method calls can be chained * together. * * @param tags
* Metadata that can be used to manage the custom metric. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateCustomMetricRequest withTags(Tag... tags) { if (getTags() == null) { this.tags = new java.util.ArrayList* Metadata that can be used to manage the custom metric. *
** Returns a reference to this object so that method calls can be chained * together. * * @param tags
* Metadata that can be used to manage the custom metric. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateCustomMetricRequest withTags(java.util.Collection* Each custom metric must have a unique client request token. If you try to * create a new custom metric that already exists with a different token, an * exception occurs. If you omit this value, Amazon Web Services SDKs will * automatically generate a unique client request. *
*
* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
*
* @return
* Each custom metric must have a unique client request token. If * you try to create a new custom metric that already exists with a * different token, an exception occurs. If you omit this value, * Amazon Web Services SDKs will automatically generate a unique * client request. *
*/ public String getClientRequestToken() { return clientRequestToken; } /** ** Each custom metric must have a unique client request token. If you try to * create a new custom metric that already exists with a different token, an * exception occurs. If you omit this value, Amazon Web Services SDKs will * automatically generate a unique client request. *
*
* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
*
* @param clientRequestToken
* Each custom metric must have a unique client request token. If * you try to create a new custom metric that already exists with * a different token, an exception occurs. If you omit this * value, Amazon Web Services SDKs will automatically generate a * unique client request. *
*/ public void setClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; } /** ** Each custom metric must have a unique client request token. If you try to * create a new custom metric that already exists with a different token, an * exception occurs. If you omit this value, Amazon Web Services SDKs will * automatically generate a unique client request. *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Length: 1 - 64
* Pattern: ^[a-zA-Z0-9-_]+$
*
* @param clientRequestToken
* Each custom metric must have a unique client request token. If * you try to create a new custom metric that already exists with * a different token, an exception occurs. If you omit this * value, Amazon Web Services SDKs will automatically generate a * unique client request. *
* @return A reference to this updated object so that method calls can be * chained together. */ public CreateCustomMetricRequest withClientRequestToken(String clientRequestToken) { this.clientRequestToken = clientRequestToken; 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 (getMetricName() != null) sb.append("metricName: " + getMetricName() + ","); if (getDisplayName() != null) sb.append("displayName: " + getDisplayName() + ","); if (getMetricType() != null) sb.append("metricType: " + getMetricType() + ","); if (getTags() != null) sb.append("tags: " + getTags() + ","); if (getClientRequestToken() != null) sb.append("clientRequestToken: " + getClientRequestToken()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMetricName() == null) ? 0 : getMetricName().hashCode()); hashCode = prime * hashCode + ((getDisplayName() == null) ? 0 : getDisplayName().hashCode()); hashCode = prime * hashCode + ((getMetricType() == null) ? 0 : getMetricType().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getClientRequestToken() == null) ? 0 : getClientRequestToken().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateCustomMetricRequest == false) return false; CreateCustomMetricRequest other = (CreateCustomMetricRequest) obj; if (other.getMetricName() == null ^ this.getMetricName() == null) return false; if (other.getMetricName() != null && other.getMetricName().equals(this.getMetricName()) == false) return false; if (other.getDisplayName() == null ^ this.getDisplayName() == null) return false; if (other.getDisplayName() != null && other.getDisplayName().equals(this.getDisplayName()) == false) return false; if (other.getMetricType() == null ^ this.getMetricType() == null) return false; if (other.getMetricType() != null && other.getMetricType().equals(this.getMetricType()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getClientRequestToken() == null ^ this.getClientRequestToken() == null) return false; if (other.getClientRequestToken() != null && other.getClientRequestToken().equals(this.getClientRequestToken()) == false) return false; return true; } }