/* * 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.cloudwatchrum.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Use this structure to define one extended metric or custom metric that RUM will send to CloudWatch or CloudWatch * Evidently. For more information, see Additional * metrics that you can send to CloudWatch and CloudWatch Evidently. *

*

* This structure is validated differently for extended metrics and custom metrics. For extended metrics that are sent * to the AWS/RUM namespace, the following validations apply: *

* *

* For custom metrics, the following validation rules apply: *

* *

* Valid key values for first-level keys in the ValueKey, EventPattern, and * DimensionKeys fields: *

* * * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class MetricDefinitionRequest implements Serializable, Cloneable, StructuredPojo { /** *

* Use this field only if you are sending the metric to CloudWatch. *

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in * CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. *

*/ private java.util.Map dimensionKeys; /** *

* The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination. *

*

* When you define extended metrics, the metric definition is not valid if EventPattern is omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. *

*/ private String eventPattern; /** *

* The name for the metric that is defined in this structure. For custom metrics, you can specify any name that you * like. For extended metrics, valid values are the following: *

* */ private String name; /** *

* If this structure is for a custom metric instead of an extended metrics, use this parameter to define the metric * namespace for that custom metric. Do not specify this parameter if this structure is for an extended metric. *

*

* You cannot use any string that starts with AWS/ for your namespace. *

*/ private String namespace; /** *

* The CloudWatch metric unit to use for this metric. If you omit this field, the metric is recorded with no unit. *

*/ private String unitLabel; /** *

* The field within the event object that the metric value is sourced from. *

*

* If you omit this field, a hardcoded value of 1 is pushed as the metric value. This is useful if you just want to * count the number of events that the filter catches. *

*

* If this metric is sent to CloudWatch Evidently, this field will be passed to Evidently raw and Evidently will * handle data extraction from the event. *

*/ private String valueKey; /** *

* Use this field only if you are sending the metric to CloudWatch. *

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in * CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. *

* * @return Use this field only if you are sending the metric to CloudWatch.

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this * metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included * in EventPattern. */ public java.util.Map getDimensionKeys() { return dimensionKeys; } /** *

* Use this field only if you are sending the metric to CloudWatch. *

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in * CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. *

* * @param dimensionKeys * Use this field only if you are sending the metric to CloudWatch.

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this * metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. */ public void setDimensionKeys(java.util.Map dimensionKeys) { this.dimensionKeys = dimensionKeys; } /** *

* Use this field only if you are sending the metric to CloudWatch. *

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this metric in * CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. *

* * @param dimensionKeys * Use this field only if you are sending the metric to CloudWatch.

*

* This field is a map of field paths to dimension names. It defines the dimensions to associate with this * metric in CloudWatch. For extended metrics, valid values for the entries in this field are the following: *

* *

* For both extended metrics and custom metrics, all dimensions listed in this field must also be included in * EventPattern. * @return Returns a reference to this object so that method calls can be chained together. */ public MetricDefinitionRequest withDimensionKeys(java.util.Map dimensionKeys) { setDimensionKeys(dimensionKeys); return this; } /** * Add a single DimensionKeys entry * * @see MetricDefinitionRequest#withDimensionKeys * @returns a reference to this object so that method calls can be chained together. */ public MetricDefinitionRequest addDimensionKeysEntry(String key, String value) { if (null == this.dimensionKeys) { this.dimensionKeys = new java.util.HashMap(); } if (this.dimensionKeys.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.dimensionKeys.put(key, value); return this; } /** * Removes all the entries added into DimensionKeys. * * @return Returns a reference to this object so that method calls can be chained together. */ public MetricDefinitionRequest clearDimensionKeysEntries() { this.dimensionKeys = null; return this; } /** *

* The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination. *

*

* When you define extended metrics, the metric definition is not valid if EventPattern is omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. *

* * @param eventPattern * The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination.

*

* When you define extended metrics, the metric definition is not valid if EventPattern is * omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. */ public void setEventPattern(String eventPattern) { this.eventPattern = eventPattern; } /** *

* The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination. *

*

* When you define extended metrics, the metric definition is not valid if EventPattern is omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. *

* * @return The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a * user's session against the pattern, and events that match the pattern are sent to the metric * destination.

*

* When you define extended metrics, the metric definition is not valid if EventPattern is * omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. */ public String getEventPattern() { return this.eventPattern; } /** *

* The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination. *

*

* When you define extended metrics, the metric definition is not valid if EventPattern is omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. *

* * @param eventPattern * The pattern that defines the metric, specified as a JSON object. RUM checks events that happen in a user's * session against the pattern, and events that match the pattern are sent to the metric destination.

*

* When you define extended metrics, the metric definition is not valid if EventPattern is * omitted. *

*

* Example event patterns: *

* *

* If the metrics destination' is CloudWatch and the event also matches a value in * DimensionKeys, then the metric is published with the specified dimensions. * @return Returns a reference to this object so that method calls can be chained together. */ public MetricDefinitionRequest withEventPattern(String eventPattern) { setEventPattern(eventPattern); return this; } /** *

* The name for the metric that is defined in this structure. For custom metrics, you can specify any name that you * like. For extended metrics, valid values are the following: *

* * * @param name * The name for the metric that is defined in this structure. For custom metrics, you can specify any name * that you like. For extended metrics, valid values are the following:

*