diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java new file mode 100644 index 000000000000..b81bc3a9aba9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Action.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Action descriptor. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Action") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class), + @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction", value = LogToMetricAction.class) +}) +public class Action { +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java new file mode 100644 index 000000000000..80aa7120efd2 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActionGroupPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An action group object for the body of patch operations. + */ +@JsonFlatten +public class ActionGroupPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionGroup.java new file mode 100644 index 000000000000..1b5c9a31129d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionGroup.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A pointer to an Azure Action Group. + */ +public class ActivityLogAlertActionGroup { + /** + * The resourceId of the action group. This cannot be null or empty. + */ + @JsonProperty(value = "actionGroupId", required = true) + private String actionGroupId; + + /** + * the dictionary of custom properties to include with the post operation. + * These data are appended to the webhook payload. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the resourceId of the action group. This cannot be null or empty. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the resourceId of the action group. This cannot be null or empty. + * + * @param actionGroupId the actionGroupId value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @param webhookProperties the webhookProperties value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionList.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionList.java new file mode 100644 index 000000000000..a041ee52cb07 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertActionList.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of activity log alert actions. + */ +public class ActivityLogAlertActionList { + /** + * The list of activity log alerts. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /** + * Get the list of activity log alerts. + * + * @return the actionGroups value + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the list of activity log alerts. + * + * @param actionGroups the actionGroups value to set + * @return the ActivityLogAlertActionList object itself. + */ + public ActivityLogAlertActionList withActionGroups(List actionGroups) { + this.actionGroups = actionGroups; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertAllOfCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertAllOfCondition.java new file mode 100644 index 000000000000..f460f2700c49 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertAllOfCondition.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met when all its member conditions + * are met. + */ +public class ActivityLogAlertAllOfCondition { + /** + * The list of activity log alert conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * Get the list of activity log alert conditions. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of activity log alert conditions. + * + * @param allOf the allOf value to set + * @return the ActivityLogAlertAllOfCondition object itself. + */ + public ActivityLogAlertAllOfCondition withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertLeafCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertLeafCondition.java new file mode 100644 index 000000000000..e301eb627ad9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertLeafCondition.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met by comparing an activity log + * field and value. + */ +public class ActivityLogAlertLeafCondition { + /** + * The name of the field that this condition will examine. The possible + * values for this field are (case-insensitive): 'resourceId', 'category', + * 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', + * 'status', 'subStatus', 'resourceType', or anything beginning with + * 'properties.'. + */ + @JsonProperty(value = "field", required = true) + private String field; + + /** + * The field value will be compared to this value (case-insensitive) to + * determine if the condition is met. + */ + @JsonProperty(value = "equals", required = true) + private String equals; + + /** + * Get the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @return the field value + */ + public String field() { + return this.field; + } + + /** + * Set the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @param field the field value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withField(String field) { + this.field = field; + return this; + } + + /** + * Get the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @return the equals value + */ + public String equals() { + return this.equals; + } + + /** + * Set the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @param equals the equals value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withEquals(String equals) { + this.equals = equals; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java new file mode 100644 index 000000000000..fb68a3a26430 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ActivityLogAlertPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An activity log alert object for the body of patch operations. + */ +@JsonFlatten +public class ActivityLogAlertPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AggregationType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AggregationType.java new file mode 100644 index 000000000000..af9ae60d93b6 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AggregationType.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AggregationType. + */ +public enum AggregationType { + /** Enum value None. */ + NONE("None"), + + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"); + + /** The actual serialized value for a AggregationType instance. */ + private String value; + + AggregationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AggregationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AggregationType object, or null if unable to parse. + */ + @JsonCreator + public static AggregationType fromString(String value) { + AggregationType[] items = AggregationType.values(); + for (AggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java new file mode 100644 index 000000000000..41429bee79cd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertRuleResourcePatch.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The alert rule object for patch operations. + */ +@JsonFlatten +public class AlertRuleResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String name; + + /** + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /** + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition", required = true) + private RuleCondition condition; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the name of the alert rule. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the alert rule. + * + * @param name the name value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description of the alert rule that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition that results in the alert rule being activated. + * + * @return the condition value + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition that results in the alert rule being activated. + * + * @param condition the condition value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java new file mode 100644 index 000000000000..ba4209cd3f12 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AlertSeverity. + */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value 0 for AlertSeverity. */ + public static final AlertSeverity ZERO = fromString("0"); + + /** Static value 1 for AlertSeverity. */ + public static final AlertSeverity ONE = fromString("1"); + + /** Static value 2 for AlertSeverity. */ + public static final AlertSeverity TWO = fromString("2"); + + /** Static value 3 for AlertSeverity. */ + public static final AlertSeverity THREE = fromString("3"); + + /** Static value 4 for AlertSeverity. */ + public static final AlertSeverity FOUR = fromString("4"); + + /** + * Creates or finds a AlertSeverity from its string representation. + * @param name a name to look for + * @return the corresponding AlertSeverity + */ + @JsonCreator + public static AlertSeverity fromString(String name) { + return fromString(name, AlertSeverity.class); + } + + /** + * @return known AlertSeverity values + */ + public static Collection values() { + return values(AlertSeverity.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java new file mode 100644 index 000000000000..2d3b222b6135 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specify action need to be taken when rule type is Alert. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction") +public class AlertingAction extends Action { + /** + * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + */ + @JsonProperty(value = "severity", required = true) + private AlertSeverity severity; + + /** + * Azure action group reference. + */ + @JsonProperty(value = "aznsAction", required = true) + private AzNsActionGroup aznsAction; + + /** + * time (in minutes) for which Alerts should be throttled or suppressed. + */ + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; + + /** + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + * + * @return the severity value + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + * + * @param severity the severity value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get azure action group reference. + * + * @return the aznsAction value + */ + public AzNsActionGroup aznsAction() { + return this.aznsAction; + } + + /** + * Set azure action group reference. + * + * @param aznsAction the aznsAction value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { + this.aznsAction = aznsAction; + return this; + } + + /** + * Get time (in minutes) for which Alerts should be throttled or suppressed. + * + * @return the throttlingInMin value + */ + public Integer throttlingInMin() { + return this.throttlingInMin; + } + + /** + * Set time (in minutes) for which Alerts should be throttled or suppressed. + * + * @param throttlingInMin the throttlingInMin value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; + return this; + } + + /** + * Get the trigger condition that results in the alert rule being. + * + * @return the trigger value + */ + public TriggerCondition trigger() { + return this.trigger; + } + + /** + * Set the trigger condition that results in the alert rule being. + * + * @param trigger the trigger value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withTrigger(TriggerCondition trigger) { + this.trigger = trigger; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java new file mode 100644 index 000000000000..49ab9ab2fd26 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ArmRoleReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An arm role receiver. + */ +public class ArmRoleReceiver { + /** + * The name of the arm role receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The arm role id. + */ + @JsonProperty(value = "roleId", required = true) + private String roleId; + + /** + * Get the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the arm role id. + * + * @return the roleId value + */ + public String roleId() { + return this.roleId; + } + + /** + * Set the arm role id. + * + * @param roleId the roleId value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withRoleId(String roleId) { + this.roleId = roleId; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutomationRunbookReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutomationRunbookReceiver.java new file mode 100644 index 000000000000..39a22ba1d944 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutomationRunbookReceiver.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Automation Runbook notification receiver. + */ +public class AutomationRunbookReceiver { + /** + * The Azure automation account Id which holds this runbook and + * authenticate to Azure resource. + */ + @JsonProperty(value = "automationAccountId", required = true) + private String automationAccountId; + + /** + * The name for this runbook. + */ + @JsonProperty(value = "runbookName", required = true) + private String runbookName; + + /** + * The resource id for webhook linked to this runbook. + */ + @JsonProperty(value = "webhookResourceId", required = true) + private String webhookResourceId; + + /** + * Indicates whether this instance is global runbook. + */ + @JsonProperty(value = "isGlobalRunbook", required = true) + private boolean isGlobalRunbook; + + /** + * Indicates name of the webhook. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * Get the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @return the automationAccountId value + */ + public String automationAccountId() { + return this.automationAccountId; + } + + /** + * Set the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @param automationAccountId the automationAccountId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withAutomationAccountId(String automationAccountId) { + this.automationAccountId = automationAccountId; + return this; + } + + /** + * Get the name for this runbook. + * + * @return the runbookName value + */ + public String runbookName() { + return this.runbookName; + } + + /** + * Set the name for this runbook. + * + * @param runbookName the runbookName value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withRunbookName(String runbookName) { + this.runbookName = runbookName; + return this; + } + + /** + * Get the resource id for webhook linked to this runbook. + * + * @return the webhookResourceId value + */ + public String webhookResourceId() { + return this.webhookResourceId; + } + + /** + * Set the resource id for webhook linked to this runbook. + * + * @param webhookResourceId the webhookResourceId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withWebhookResourceId(String webhookResourceId) { + this.webhookResourceId = webhookResourceId; + return this; + } + + /** + * Get indicates whether this instance is global runbook. + * + * @return the isGlobalRunbook value + */ + public boolean isGlobalRunbook() { + return this.isGlobalRunbook; + } + + /** + * Set indicates whether this instance is global runbook. + * + * @param isGlobalRunbook the isGlobalRunbook value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withIsGlobalRunbook(boolean isGlobalRunbook) { + this.isGlobalRunbook = isGlobalRunbook; + return this; + } + + /** + * Get indicates name of the webhook. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set indicates name of the webhook. + * + * @param name the name value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleNotification.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleNotification.java new file mode 100644 index 000000000000..55644e199b1d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleNotification.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Autoscale notification. + */ +public class AutoscaleNotification { + /** + * the operation associated with the notification and its value must be + * "scale". + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /** + * the email notification. + */ + @JsonProperty(value = "email") + private EmailNotification email; + + /** + * the collection of webhook notifications. + */ + @JsonProperty(value = "webhooks") + private List webhooks; + + /** + * Creates an instance of AutoscaleNotification class. + */ + public AutoscaleNotification() { + operation = "Scale"; + } + + /** + * Get the operation associated with the notification and its value must be "scale". + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation associated with the notification and its value must be "scale". + * + * @param operation the operation value to set + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the email notification. + * + * @return the email value + */ + public EmailNotification email() { + return this.email; + } + + /** + * Set the email notification. + * + * @param email the email value to set + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withEmail(EmailNotification email) { + this.email = email; + return this; + } + + /** + * Get the collection of webhook notifications. + * + * @return the webhooks value + */ + public List webhooks() { + return this.webhooks; + } + + /** + * Set the collection of webhook notifications. + * + * @param webhooks the webhooks value to set + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withWebhooks(List webhooks) { + this.webhooks = webhooks; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleProfile.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleProfile.java new file mode 100644 index 000000000000..da79e4058752 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleProfile.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Autoscale profile. + */ +public class AutoscaleProfile { + /** + * the name of the profile. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * the number of instances that can be used during this profile. + */ + @JsonProperty(value = "capacity", required = true) + private ScaleCapacity capacity; + + /** + * the collection of rules that provide the triggers and parameters for the + * scaling action. A maximum of 10 rules can be specified. + */ + @JsonProperty(value = "rules", required = true) + private List rules; + + /** + * the specific date-time for the profile. This element is not used if the + * Recurrence element is used. + */ + @JsonProperty(value = "fixedDate") + private TimeWindow fixedDate; + + /** + * the repeating times at which this profile begins. This element is not + * used if the FixedDate element is used. + */ + @JsonProperty(value = "recurrence") + private Recurrence recurrence; + + /** + * Get the name of the profile. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the profile. + * + * @param name the name value to set + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get the number of instances that can be used during this profile. + * + * @return the capacity value + */ + public ScaleCapacity capacity() { + return this.capacity; + } + + /** + * Set the number of instances that can be used during this profile. + * + * @param capacity the capacity value to set + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withCapacity(ScaleCapacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. + * + * @return the rules value + */ + public List rules() { + return this.rules; + } + + /** + * Set the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified. + * + * @param rules the rules value to set + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the specific date-time for the profile. This element is not used if the Recurrence element is used. + * + * @return the fixedDate value + */ + public TimeWindow fixedDate() { + return this.fixedDate; + } + + /** + * Set the specific date-time for the profile. This element is not used if the Recurrence element is used. + * + * @param fixedDate the fixedDate value to set + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withFixedDate(TimeWindow fixedDate) { + this.fixedDate = fixedDate; + return this; + } + + /** + * Get the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + * + * @return the recurrence value + */ + public Recurrence recurrence() { + return this.recurrence; + } + + /** + * Set the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + * + * @param recurrence the recurrence value to set + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withRecurrence(Recurrence recurrence) { + this.recurrence = recurrence; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java new file mode 100644 index 000000000000..8633ae4c2d09 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AutoscaleSettingResourcePatch.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The autoscale setting object for patch operations. + */ +@JsonFlatten +public class AutoscaleSettingResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the collection of automatic scaling profiles that specify different + * scaling parameters for different time periods. A maximum of 20 profiles + * can be specified. + */ + @JsonProperty(value = "properties.profiles", required = true) + private List profiles; + + /** + * the collection of notifications. + */ + @JsonProperty(value = "properties.notifications") + private List notifications; + + /** + * the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'true'. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * the name of the autoscale setting. + */ + @JsonProperty(value = "properties.name") + private String name; + + /** + * the resource identifier of the resource that the autoscale setting + * should be added to. + */ + @JsonProperty(value = "properties.targetResourceUri") + private String targetResourceUri; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value + */ + public List profiles() { + return this.profiles; + } + + /** + * Set the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + * + * @param profiles the profiles value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withProfiles(List profiles) { + this.profiles = profiles; + return this; + } + + /** + * Get the collection of notifications. + * + * @return the notifications value + */ + public List notifications() { + return this.notifications; + } + + /** + * Set the collection of notifications. + * + * @param notifications the notifications value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withNotifications(List notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param enabled the enabled value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the name of the autoscale setting. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the autoscale setting. + * + * @param name the name value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resource identifier of the resource that the autoscale setting should be added to. + * + * @return the targetResourceUri value + */ + public String targetResourceUri() { + return this.targetResourceUri; + } + + /** + * Set the resource identifier of the resource that the autoscale setting should be added to. + * + * @param targetResourceUri the targetResourceUri value to set + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTargetResourceUri(String targetResourceUri) { + this.targetResourceUri = targetResourceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java new file mode 100644 index 000000000000..c8124623c2d7 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure action group. + */ +public class AzNsActionGroup { + /** + * Azure Action Group reference. + */ + @JsonProperty(value = "actionGroup") + private List actionGroup; + + /** + * Custom subject override for all email ids in Azure action group. + */ + @JsonProperty(value = "emailSubject") + private String emailSubject; + + /** + * Custom payload to be sent for all webhook URI in Azure action group. + */ + @JsonProperty(value = "customWebhookPayload") + private String customWebhookPayload; + + /** + * Get azure Action Group reference. + * + * @return the actionGroup value + */ + public List actionGroup() { + return this.actionGroup; + } + + /** + * Set azure Action Group reference. + * + * @param actionGroup the actionGroup value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withActionGroup(List actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + /** + * Get custom subject override for all email ids in Azure action group. + * + * @return the emailSubject value + */ + public String emailSubject() { + return this.emailSubject; + } + + /** + * Set custom subject override for all email ids in Azure action group. + * + * @param emailSubject the emailSubject value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withEmailSubject(String emailSubject) { + this.emailSubject = emailSubject; + return this; + } + + /** + * Get custom payload to be sent for all webhook URI in Azure action group. + * + * @return the customWebhookPayload value + */ + public String customWebhookPayload() { + return this.customWebhookPayload; + } + + /** + * Set custom payload to be sent for all webhook URI in Azure action group. + * + * @param customWebhookPayload the customWebhookPayload value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withCustomWebhookPayload(String customWebhookPayload) { + this.customWebhookPayload = customWebhookPayload; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureAppPushReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureAppPushReceiver.java new file mode 100644 index 000000000000..823c31bcd3c6 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureAppPushReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure mobile App push notification receiver. + */ +public class AzureAppPushReceiver { + /** + * The name of the Azure mobile app push receiver. Names must be unique + * across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * Get the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address registered for the Azure mobile app. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java new file mode 100644 index 000000000000..3abb6c152830 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzureFunctionReceiver.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An azure function receiver. + */ +public class AzureFunctionReceiver { + /** + * The name of the azure function receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the function app. + */ + @JsonProperty(value = "functionAppResourceId", required = true) + private String functionAppResourceId; + + /** + * The function name in the function app. + */ + @JsonProperty(value = "functionName", required = true) + private String functionName; + + /** + * The http trigger url where http request sent to. + */ + @JsonProperty(value = "httpTriggerUrl", required = true) + private String httpTriggerUrl; + + /** + * Get the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the function app. + * + * @return the functionAppResourceId value + */ + public String functionAppResourceId() { + return this.functionAppResourceId; + } + + /** + * Set the azure resource id of the function app. + * + * @param functionAppResourceId the functionAppResourceId value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionAppResourceId(String functionAppResourceId) { + this.functionAppResourceId = functionAppResourceId; + return this; + } + + /** + * Get the function name in the function app. + * + * @return the functionName value + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the function name in the function app. + * + * @param functionName the functionName value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the http trigger url where http request sent to. + * + * @return the httpTriggerUrl value + */ + public String httpTriggerUrl() { + return this.httpTriggerUrl; + } + + /** + * Set the http trigger url where http request sent to. + * + * @param httpTriggerUrl the httpTriggerUrl value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withHttpTriggerUrl(String httpTriggerUrl) { + this.httpTriggerUrl = httpTriggerUrl; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Baseline.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Baseline.java new file mode 100644 index 000000000000..c74092ab9250 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Baseline.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The baseline values for a single sensitivity value. + */ +public class Baseline { + /** + * the sensitivity of the baseline. Possible values include: 'Low', + * 'Medium', 'High'. + */ + @JsonProperty(value = "sensitivity", required = true) + private Sensitivity sensitivity; + + /** + * The low thresholds of the baseline. + */ + @JsonProperty(value = "lowThresholds", required = true) + private List lowThresholds; + + /** + * The high thresholds of the baseline. + */ + @JsonProperty(value = "highThresholds", required = true) + private List highThresholds; + + /** + * Get the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @return the sensitivity value + */ + public Sensitivity sensitivity() { + return this.sensitivity; + } + + /** + * Set the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @param sensitivity the sensitivity value to set + * @return the Baseline object itself. + */ + public Baseline withSensitivity(Sensitivity sensitivity) { + this.sensitivity = sensitivity; + return this; + } + + /** + * Get the low thresholds of the baseline. + * + * @return the lowThresholds value + */ + public List lowThresholds() { + return this.lowThresholds; + } + + /** + * Set the low thresholds of the baseline. + * + * @param lowThresholds the lowThresholds value to set + * @return the Baseline object itself. + */ + public Baseline withLowThresholds(List lowThresholds) { + this.lowThresholds = lowThresholds; + return this; + } + + /** + * Get the high thresholds of the baseline. + * + * @return the highThresholds value + */ + public List highThresholds() { + return this.highThresholds; + } + + /** + * Set the high thresholds of the baseline. + * + * @param highThresholds the highThresholds value to set + * @return the Baseline object itself. + */ + public Baseline withHighThresholds(List highThresholds) { + this.highThresholds = highThresholds; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadataValue.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadataValue.java new file mode 100644 index 000000000000..a909e14e1ac9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/BaselineMetadataValue.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.microsoft.azure.management.monitor.implementation.LocalizableStringInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a baseline metadata value. + */ +public class BaselineMetadataValue { + /** + * the name of the metadata. + */ + @JsonProperty(value = "name") + private LocalizableStringInner name; + + /** + * the value of the metadata. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name of the metadata. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name of the metadata. + * + * @param name the name value to set + * @return the BaselineMetadataValue object itself. + */ + public BaselineMetadataValue withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the value of the metadata. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value of the metadata. + * + * @param value the value value to set + * @return the BaselineMetadataValue object itself. + */ + public BaselineMetadataValue withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/CategoryType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/CategoryType.java new file mode 100644 index 000000000000..b7dc8c31906c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/CategoryType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for CategoryType. + */ +public enum CategoryType { + /** Enum value Metrics. */ + METRICS("Metrics"), + + /** Enum value Logs. */ + LOGS("Logs"); + + /** The actual serialized value for a CategoryType instance. */ + private String value; + + CategoryType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CategoryType instance. + * + * @param value the serialized value to parse. + * @return the parsed CategoryType object, or null if unable to parse. + */ + @JsonCreator + public static CategoryType fromString(String value) { + CategoryType[] items = CategoryType.values(); + for (CategoryType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ComparisonOperationType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ComparisonOperationType.java new file mode 100644 index 000000000000..d684d4623f8e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ComparisonOperationType.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ComparisonOperationType. + */ +public enum ComparisonOperationType { + /** Enum value Equals. */ + EQUALS("Equals"), + + /** Enum value NotEquals. */ + NOT_EQUALS("NotEquals"), + + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"); + + /** The actual serialized value for a ComparisonOperationType instance. */ + private String value; + + ComparisonOperationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComparisonOperationType instance. + * + * @param value the serialized value to parse. + * @return the parsed ComparisonOperationType object, or null if unable to parse. + */ + @JsonCreator + public static ComparisonOperationType fromString(String value) { + ComparisonOperationType[] items = ComparisonOperationType.values(); + for (ComparisonOperationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionOperator.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionOperator.java new file mode 100644 index 000000000000..7f03739e4480 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionOperator.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ConditionOperator. + */ +public enum ConditionOperator { + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"); + + /** The actual serialized value for a ConditionOperator instance. */ + private String value; + + ConditionOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ConditionOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed ConditionOperator object, or null if unable to parse. + */ + @JsonCreator + public static ConditionOperator fromString(String value) { + ConditionOperator[] items = ConditionOperator.values(); + for (ConditionOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java new file mode 100644 index 000000000000..a853f79cd0fc --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConditionalOperator. + */ +public final class ConditionalOperator extends ExpandableStringEnum { + /** Static value GreaterThan for ConditionalOperator. */ + public static final ConditionalOperator GREATER_THAN = fromString("GreaterThan"); + + /** Static value LessThan for ConditionalOperator. */ + public static final ConditionalOperator LESS_THAN = fromString("LessThan"); + + /** Static value Equal for ConditionalOperator. */ + public static final ConditionalOperator EQUAL = fromString("Equal"); + + /** + * Creates or finds a ConditionalOperator from its string representation. + * @param name a name to look for + * @return the corresponding ConditionalOperator + */ + @JsonCreator + public static ConditionalOperator fromString(String name) { + return fromString(name, ConditionalOperator.class); + } + + /** + * @return known ConditionalOperator values + */ + public static Collection values() { + return values(ConditionalOperator.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Criteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Criteria.java new file mode 100644 index 000000000000..25caf7322837 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Criteria.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the criteria for converting log to metric. + */ +public class Criteria { + /** + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * List of Dimensions for creating metric. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get name of the metric. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set name of the metric. + * + * @param metricName the metricName value to set + * @return the Criteria object itself. + */ + public Criteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get list of Dimensions for creating metric. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set list of Dimensions for creating metric. + * + * @param dimensions the dimensions value to set + * @return the Criteria object itself. + */ + public Criteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataContainer.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataContainer.java new file mode 100644 index 000000000000..c79165e38dfd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataContainer.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a container with data for a given resource. + */ +public class DataContainer { + /** + * Log Analytics workspace information. + */ + @JsonProperty(value = "workspace", required = true) + private WorkspaceInfo workspace; + + /** + * Get log Analytics workspace information. + * + * @return the workspace value + */ + public WorkspaceInfo workspace() { + return this.workspace; + } + + /** + * Set log Analytics workspace information. + * + * @param workspace the workspace value to set + * @return the DataContainer object itself. + */ + public DataContainer withWorkspace(WorkspaceInfo workspace) { + this.workspace = workspace; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataStatus.java new file mode 100644 index 000000000000..1f5965037832 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/DataStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataStatus. + */ +public final class DataStatus extends ExpandableStringEnum { + /** Static value present for DataStatus. */ + public static final DataStatus PRESENT = fromString("present"); + + /** Static value notPresent for DataStatus. */ + public static final DataStatus NOT_PRESENT = fromString("notPresent"); + + /** + * Creates or finds a DataStatus from its string representation. + * @param name a name to look for + * @return the corresponding DataStatus + */ + @JsonCreator + public static DataStatus fromString(String name) { + return fromString(name, DataStatus.class); + } + + /** + * @return known DataStatus values + */ + public static Collection values() { + return values(DataStatus.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Dimension.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Dimension.java new file mode 100644 index 000000000000..45326adf3cfa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Dimension.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the criteria for converting log to metric. + */ +public class Dimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Operator for dimension values. + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /** + * List of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Creates an instance of Dimension class. + * @param name name of the dimension. + * @param values list of dimension values. + */ + public Dimension() { + operator = "Include"; + } + + /** + * Get name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the dimension. + * + * @param name the name value to set + * @return the Dimension object itself. + */ + public Dimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get operator for dimension values. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set operator for dimension values. + * + * @param operator the operator value to set + * @return the Dimension object itself. + */ + public Dimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get list of dimension values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set list of dimension values. + * + * @param values the values value to set + * @return the Dimension object itself. + */ + public Dimension withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailNotification.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailNotification.java new file mode 100644 index 000000000000..7b0716bfdcca --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailNotification.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Email notification of an autoscale event. + */ +public class EmailNotification { + /** + * a value indicating whether to send email to subscription administrator. + */ + @JsonProperty(value = "sendToSubscriptionAdministrator") + private Boolean sendToSubscriptionAdministrator; + + /** + * a value indicating whether to send email to subscription + * co-administrators. + */ + @JsonProperty(value = "sendToSubscriptionCoAdministrators") + private Boolean sendToSubscriptionCoAdministrators; + + /** + * the custom e-mails list. This value can be null or empty, in which case + * this attribute will be ignored. + */ + @JsonProperty(value = "customEmails") + private List customEmails; + + /** + * Get a value indicating whether to send email to subscription administrator. + * + * @return the sendToSubscriptionAdministrator value + */ + public Boolean sendToSubscriptionAdministrator() { + return this.sendToSubscriptionAdministrator; + } + + /** + * Set a value indicating whether to send email to subscription administrator. + * + * @param sendToSubscriptionAdministrator the sendToSubscriptionAdministrator value to set + * @return the EmailNotification object itself. + */ + public EmailNotification withSendToSubscriptionAdministrator(Boolean sendToSubscriptionAdministrator) { + this.sendToSubscriptionAdministrator = sendToSubscriptionAdministrator; + return this; + } + + /** + * Get a value indicating whether to send email to subscription co-administrators. + * + * @return the sendToSubscriptionCoAdministrators value + */ + public Boolean sendToSubscriptionCoAdministrators() { + return this.sendToSubscriptionCoAdministrators; + } + + /** + * Set a value indicating whether to send email to subscription co-administrators. + * + * @param sendToSubscriptionCoAdministrators the sendToSubscriptionCoAdministrators value to set + * @return the EmailNotification object itself. + */ + public EmailNotification withSendToSubscriptionCoAdministrators(Boolean sendToSubscriptionCoAdministrators) { + this.sendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; + return this; + } + + /** + * Get the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + * + * @return the customEmails value + */ + public List customEmails() { + return this.customEmails; + } + + /** + * Set the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + * + * @param customEmails the customEmails value to set + * @return the EmailNotification object itself. + */ + public EmailNotification withCustomEmails(List customEmails) { + this.customEmails = customEmails; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailReceiver.java new file mode 100644 index 000000000000..8a6ea4c12590 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EmailReceiver.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An email receiver. + */ +public class EmailReceiver { + /** + * The name of the email receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * The receiver status of the e-mail. Possible values include: + * 'NotSpecified', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address of this receiver. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of this receiver. + * + * @param emailAddress the emailAddress value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EnableRequest.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EnableRequest.java new file mode 100644 index 000000000000..c3df8ba3f770 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EnableRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a receiver that should be resubscribed. + */ +public class EnableRequest { + /** + * The name of the receiver to resubscribe. + */ + @JsonProperty(value = "receiverName", required = true) + private String receiverName; + + /** + * Get the name of the receiver to resubscribe. + * + * @return the receiverName value + */ + public String receiverName() { + return this.receiverName; + } + + /** + * Set the name of the receiver to resubscribe. + * + * @param receiverName the receiverName value to set + * @return the EnableRequest object itself. + */ + public EnableRequest withReceiverName(String receiverName) { + this.receiverName = receiverName; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java new file mode 100644 index 000000000000..7f7eebb1c20c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Enabled. + */ +public final class Enabled extends ExpandableStringEnum { + /** Static value true for Enabled. */ + public static final Enabled TRUE = fromString("true"); + + /** Static value false for Enabled. */ + public static final Enabled FALSE = fromString("false"); + + /** + * Creates or finds a Enabled from its string representation. + * @param name a name to look for + * @return the corresponding Enabled + */ + @JsonCreator + public static Enabled fromString(String name) { + return fromString(name, Enabled.class); + } + + /** + * @return known Enabled values + */ + public static Collection values() { + return values(Enabled.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Error.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Error.java new file mode 100644 index 000000000000..937ddb38e9b0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Error.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + */ +public class Error { + /** + * Error code identifying the specific error. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /** + * Error message in the caller's locale. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code identifying the specific error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code identifying the specific error. + * + * @param code the code value to set + * @return the Error object itself. + */ + public Error withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message in the caller's locale. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message in the caller's locale. + * + * @param message the message value to set + * @return the Error object itself. + */ + public Error withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponse.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponse.java new file mode 100644 index 000000000000..4dc1acf70ba1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponseException.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponseException.java new file mode 100644 index 000000000000..14c196ab1985 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EventLevel.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EventLevel.java new file mode 100644 index 000000000000..6d6b766d5827 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/EventLevel.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for EventLevel. + */ +public enum EventLevel { + /** Enum value Critical. */ + CRITICAL("Critical"), + + /** Enum value Error. */ + ERROR("Error"), + + /** Enum value Warning. */ + WARNING("Warning"), + + /** Enum value Informational. */ + INFORMATIONAL("Informational"), + + /** Enum value Verbose. */ + VERBOSE("Verbose"); + + /** The actual serialized value for a EventLevel instance. */ + private String value; + + EventLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EventLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed EventLevel object, or null if unable to parse. + */ + @JsonCreator + public static EventLevel fromString(String value) { + EventLevel[] items = EventLevel.values(); + for (EventLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/HttpRequestInfo.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/HttpRequestInfo.java new file mode 100644 index 000000000000..6691d8c1d369 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/HttpRequestInfo.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Http request info. + */ +public class HttpRequestInfo { + /** + * the client request id. + */ + @JsonProperty(value = "clientRequestId") + private String clientRequestId; + + /** + * the client Ip Address. + */ + @JsonProperty(value = "clientIpAddress") + private String clientIpAddress; + + /** + * the Http request method. + */ + @JsonProperty(value = "method") + private String method; + + /** + * the Uri. + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the client request id. + * + * @return the clientRequestId value + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the client request id. + * + * @param clientRequestId the clientRequestId value to set + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the client Ip Address. + * + * @return the clientIpAddress value + */ + public String clientIpAddress() { + return this.clientIpAddress; + } + + /** + * Set the client Ip Address. + * + * @param clientIpAddress the clientIpAddress value to set + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withClientIpAddress(String clientIpAddress) { + this.clientIpAddress = clientIpAddress; + return this; + } + + /** + * Get the Http request method. + * + * @return the method value + */ + public String method() { + return this.method; + } + + /** + * Set the Http request method. + * + * @param method the method value to set + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the Uri. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the Uri. + * + * @param uri the uri value to set + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withUri(String uri) { + this.uri = uri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ItsmReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ItsmReceiver.java new file mode 100644 index 000000000000..92dd4f6c2f31 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ItsmReceiver.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Itsm receiver. + */ +public class ItsmReceiver { + /** + * The name of the Itsm receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * OMS LA instance identifier. + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /** + * Unique identification of ITSM connection among multiple defined in above + * workspace. + */ + @JsonProperty(value = "connectionId", required = true) + private String connectionId; + + /** + * JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + */ + @JsonProperty(value = "ticketConfiguration", required = true) + private String ticketConfiguration; + + /** + * Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get oMS LA instance identifier. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set oMS LA instance identifier. + * + * @param workspaceId the workspaceId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get unique identification of ITSM connection among multiple defined in above workspace. + * + * @return the connectionId value + */ + public String connectionId() { + return this.connectionId; + } + + /** + * Set unique identification of ITSM connection among multiple defined in above workspace. + * + * @param connectionId the connectionId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withConnectionId(String connectionId) { + this.connectionId = connectionId; + return this; + } + + /** + * Get jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @return the ticketConfiguration value + */ + public String ticketConfiguration() { + return this.ticketConfiguration; + } + + /** + * Set jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @param ticketConfiguration the ticketConfiguration value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withTicketConfiguration(String ticketConfiguration) { + this.ticketConfiguration = ticketConfiguration; + return this; + } + + /** + * Get region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @param region the region value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LocationThresholdRuleCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LocationThresholdRuleCondition.java new file mode 100644 index 000000000000..b14cc6c5d824 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LocationThresholdRuleCondition.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule condition based on a certain number of locations failing. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition") +public class LocationThresholdRuleCondition extends RuleCondition { + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * the number of locations that must fail to activate the alert. + */ + @JsonProperty(value = "failedLocationCount", required = true) + private int failedLocationCount; + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the number of locations that must fail to activate the alert. + * + * @return the failedLocationCount value + */ + public int failedLocationCount() { + return this.failedLocationCount; + } + + /** + * Set the number of locations that must fail to activate the alert. + * + * @param failedLocationCount the failedLocationCount value to set + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withFailedLocationCount(int failedLocationCount) { + this.failedLocationCount = failedLocationCount; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogMetricTrigger.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogMetricTrigger.java new file mode 100644 index 000000000000..4dfcc50da0c3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogMetricTrigger.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A log metrics trigger descriptor. + */ +public class LogMetricTrigger { + /** + * Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator") + private ConditionalOperator thresholdOperator; + + /** + * The threshold of the metric trigger. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /** + * Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: + * 'Consecutive', 'Total'. + */ + @JsonProperty(value = "metricTriggerType") + private MetricTriggerType metricTriggerType; + + /** + * Evaluation of metric on a particular column. + */ + @JsonProperty(value = "metricColumn") + private String metricColumn; + + /** + * Get evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold of the metric trigger. + * + * @return the threshold value + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold of the metric trigger. + * + * @param threshold the threshold value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'. + * + * @return the metricTriggerType value + */ + public MetricTriggerType metricTriggerType() { + return this.metricTriggerType; + } + + /** + * Set metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'. + * + * @param metricTriggerType the metricTriggerType value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricTriggerType(MetricTriggerType metricTriggerType) { + this.metricTriggerType = metricTriggerType; + return this; + } + + /** + * Get evaluation of metric on a particular column. + * + * @return the metricColumn value + */ + public String metricColumn() { + return this.metricColumn; + } + + /** + * Set evaluation of metric on a particular column. + * + * @param metricColumn the metricColumn value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricColumn(String metricColumn) { + this.metricColumn = metricColumn; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java new file mode 100644 index 000000000000..90a479f7a8e3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogProfileResourcePatch.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The log profile resource for patch operations. + */ +@JsonFlatten +public class LogProfileResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming the Activity Log. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * List of regions for which Activity Log events should be stored or + * streamed. It is a comma separated list of valid ARM locations including + * the 'global' location. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or + * 'Action.'. + */ + @JsonProperty(value = "properties.categories", required = true) + private List categories; + + /** + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the resource id of the storage account to which you would like to send the Activity Log. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource id of the storage account to which you would like to send the Activity Log. + * + * @param storageAccountId the storageAccountId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @param locations the locations value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retention policy for the events in the log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSearchRuleResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSearchRuleResourcePatch.java new file mode 100644 index 000000000000..311953f8586d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSearchRuleResourcePatch.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The log search rule resource for patch operations. + */ +@JsonFlatten +public class LogSearchRuleResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSettings.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSettings.java new file mode 100644 index 000000000000..e3cece09f69d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogSettings.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + */ +public class LogSettings { + /** + * Name of a Diagnostic Log category for a resource type this setting is + * applied to. To obtain the list of Diagnostic Log categories for a + * resource, first perform a GET diagnostic settings operation. + */ + @JsonProperty(value = "category") + private String category; + + /** + * a value indicating whether this log is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the retention policy for this log. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** + * Get name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + * + * @param category the category value to set + * @return the LogSettings object itself. + */ + public LogSettings withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get a value indicating whether this log is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether this log is enabled. + * + * @param enabled the enabled value to set + * @return the LogSettings object itself. + */ + public LogSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retention policy for this log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for this log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogSettings object itself. + */ + public LogSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java new file mode 100644 index 000000000000..a1f5e4d94ad3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogToMetricAction.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specify action need to be taken when rule type is converting log to metric. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction") +public class LogToMetricAction extends Action { + /** + * Severity of the alert. + */ + @JsonProperty(value = "criteria", required = true) + private Criteria criteria; + + /** + * Get severity of the alert. + * + * @return the criteria value + */ + public Criteria criteria() { + return this.criteria; + } + + /** + * Set severity of the alert. + * + * @param criteria the criteria value to set + * @return the LogToMetricAction object itself. + */ + public LogToMetricAction withCriteria(Criteria criteria) { + this.criteria = criteria; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java new file mode 100644 index 000000000000..ca0328c7e00c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/LogicAppReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A logic app receiver. + */ +public class LogicAppReceiver { + /** + * The name of the logic app receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the logic app receiver. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * The callback url where http request sent to. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /** + * Get the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the logic app receiver. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the azure resource id of the logic app receiver. + * + * @param resourceId the resourceId value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the callback url where http request sent to. + * + * @return the callbackUrl value + */ + public String callbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callback url where http request sent to. + * + * @param callbackUrl the callbackUrl value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventAggregationCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventAggregationCondition.java new file mode 100644 index 000000000000..7ebf7f72fe61 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventAggregationCondition.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * How the data that is collected should be combined over time. + */ +public class ManagementEventAggregationCondition { + /** + * the condition operator. Possible values include: 'GreaterThan', + * 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + */ + @JsonProperty(value = "operator") + private ConditionOperator operator; + + /** + * The threshold value that activates the alert. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * Get the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @return the operator value + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @param operator the operator value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold value that activates the alert. + * + * @return the threshold value + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventRuleCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventRuleCondition.java new file mode 100644 index 000000000000..f0f81f1ca64a --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ManagementEventRuleCondition.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A management event rule condition. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition") +public class ManagementEventRuleCondition extends RuleCondition { + /** + * How the data that is collected should be combined over time and when the + * alert is activated. Note that for management event alerts aggregation is + * optional – if it is not provided then any event will cause the alert to + * activate. + */ + @JsonProperty(value = "aggregation") + private ManagementEventAggregationCondition aggregation; + + /** + * Get how the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + * + * @return the aggregation value + */ + public ManagementEventAggregationCondition aggregation() { + return this.aggregation; + } + + /** + * Set how the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + * + * @param aggregation the aggregation value to set + * @return the ManagementEventRuleCondition object itself. + */ + public ManagementEventRuleCondition withAggregation(ManagementEventAggregationCondition aggregation) { + this.aggregation = aggregation; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetadataValue.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetadataValue.java new file mode 100644 index 000000000000..ccdc78e1772b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetadataValue.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.microsoft.azure.management.monitor.implementation.LocalizableStringInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a metric metadata value. + */ +public class MetadataValue { + /** + * the name of the metadata. + */ + @JsonProperty(value = "name") + private LocalizableStringInner name; + + /** + * the value of the metadata. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name of the metadata. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name of the metadata. + * + * @param name the name value to set + * @return the MetadataValue object itself. + */ + public MetadataValue withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the value of the metadata. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value of the metadata. + * + * @param value the value value to set + * @return the MetadataValue object itself. + */ + public MetadataValue withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java new file mode 100644 index 000000000000..a7c3fb2bbf66 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertAction.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert action. + */ +public class MetricAlertAction { + /** + * the id of the action group to use. + */ + @JsonProperty(value = "actionGroupId") + private String actionGroupId; + + /** + * The properties of a webhook object. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the id of the action group to use. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the id of the action group to use. + * + * @param actionGroupId the actionGroupId value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the properties of a webhook object. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the properties of a webhook object. + * + * @param webhookProperties the webhookProperties value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java new file mode 100644 index 000000000000..188f26d42573 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertCriteria.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The rule criteria that defines the conditions of the alert rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("MetricAlertCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", value = MetricAlertSingleResourceMultipleMetricCriteria.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", value = MetricAlertMultipleResourceMultipleMetricCriteria.class) +}) +public class MetricAlertCriteria { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the MetricAlertCriteria object itself. + */ + public MetricAlertCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertMultipleResourceMultipleMetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertMultipleResourceMultipleMetricCriteria.java new file mode 100644 index 000000000000..4261b19e51c8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertMultipleResourceMultipleMetricCriteria.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the metric alert criteria for multiple resource that has multiple + * metric criteria. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria") +public class MetricAlertMultipleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /** + * the list of multiple metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** + * Get the list of multiple metric criteria for this 'all of' operation. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of multiple metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set + * @return the MetricAlertMultipleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertMultipleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java new file mode 100644 index 000000000000..3a7e86e2ccda --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertResourcePatch.java @@ -0,0 +1,357 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The metric alert resource for patch operations. + */ +@JsonFlatten +public class MetricAlertResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceType") + private String targetResourceType; + + /** + * the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceRegion") + private String targetResourceRegion; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description of the metric alert that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get defines the specific alert criteria information. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set defines the specific alert criteria information. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the flag that indicates whether the alert should be auto resolved or not. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the flag that indicates whether the alert should be auto resolved or not. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java new file mode 100644 index 000000000000..2a13ea6056aa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertSingleResourceMultipleMetricCriteria.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria") +public class MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /** + * The list of metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** + * Get the list of metric criteria for this 'all of' operation. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set + * @return the MetricAlertSingleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertSingleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java new file mode 100644 index 000000000000..c4a5f7f7e469 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatus.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status. + */ +public class MetricAlertStatus { + /** + * The status name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The alert rule arm id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The extended resource type name. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The alert status properties of the metric alert status. + */ + @JsonProperty(value = "properties") + private MetricAlertStatusProperties properties; + + /** + * Get the status name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the status name. + * + * @param name the name value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withName(String name) { + this.name = name; + return this; + } + + /** + * Get the alert rule arm id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the alert rule arm id. + * + * @param id the id value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withId(String id) { + this.id = id; + return this; + } + + /** + * Get the extended resource type name. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the extended resource type name. + * + * @param type the type value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withType(String type) { + this.type = type; + return this; + } + + /** + * Get the alert status properties of the metric alert status. + * + * @return the properties value + */ + public MetricAlertStatusProperties properties() { + return this.properties; + } + + /** + * Set the alert status properties of the metric alert status. + * + * @param properties the properties value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withProperties(MetricAlertStatusProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java new file mode 100644 index 000000000000..b6f239e847e6 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAlertStatusProperties.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status properties. + */ +public class MetricAlertStatusProperties { + /** + * An object describing the type of the dimensions. + */ + @JsonProperty(value = "dimensions") + private Map dimensions; + + /** + * status value. + */ + @JsonProperty(value = "status") + private String status; + + /** + * UTC time when the status was checked. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Get an object describing the type of the dimensions. + * + * @return the dimensions value + */ + public Map dimensions() { + return this.dimensions; + } + + /** + * Set an object describing the type of the dimensions. + * + * @param dimensions the dimensions value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withDimensions(Map dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status value. + * + * @param status the status value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get uTC time when the status was checked. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set uTC time when the status was checked. + * + * @param timestamp the timestamp value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAvailability.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAvailability.java new file mode 100644 index 000000000000..a506a180412a --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricAvailability.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + */ +public class MetricAvailability { + /** + * the time grain specifies the aggregation interval for the metric. + * Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "timeGrain") + private Period timeGrain; + + /** + * the retention period for the metric at the specified timegrain. + * Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "retention") + private Period retention; + + /** + * Get the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @return the timeGrain value + */ + public Period timeGrain() { + return this.timeGrain; + } + + /** + * Set the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @param timeGrain the timeGrain value to set + * @return the MetricAvailability object itself. + */ + public MetricAvailability withTimeGrain(Period timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @return the retention value + */ + public Period retention() { + return this.retention; + } + + /** + * Set the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @param retention the retention value to set + * @return the MetricAvailability object itself. + */ + public MetricAvailability withRetention(Period retention) { + this.retention = retention; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java new file mode 100644 index 000000000000..86e8363dc4c1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricCriteria.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Criterion to filter metrics. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("StaticThresholdCriterion") +public class MetricCriteria extends MultiMetricCriteria { + /** + * Name of the criteria. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * Namespace of the metric. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /** + * the criteria operator. + */ + @JsonProperty(value = "operator", required = true) + private Object operator; + + /** + * the criteria time aggregation types. + */ + @JsonProperty(value = "timeAggregation", required = true) + private Object timeAggregation; + + /** + * the criteria threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * List of dimension conditions. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get name of the criteria. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the criteria. + * + * @param name the name value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withName(String name) { + this.name = name; + return this; + } + + /** + * Get name of the metric. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set name of the metric. + * + * @param metricName the metricName value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get namespace of the metric. + * + * @return the metricNamespace value + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set namespace of the metric. + * + * @param metricNamespace the metricNamespace value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Get the criteria operator. + * + * @return the operator value + */ + public Object operator() { + return this.operator; + } + + /** + * Set the criteria operator. + * + * @param operator the operator value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withOperator(Object operator) { + this.operator = operator; + return this; + } + + /** + * Get the criteria time aggregation types. + * + * @return the timeAggregation value + */ + public Object timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the criteria time aggregation types. + * + * @param timeAggregation the timeAggregation value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withTimeAggregation(Object timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the criteria threshold value that activates the alert. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the criteria threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get list of dimension conditions. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set list of dimension conditions. + * + * @param dimensions the dimensions value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java new file mode 100644 index 000000000000..c7ffc61f1e7f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricDimension.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies a metric dimension. + */ +public class MetricDimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * the dimension operator. Only 'Include' and 'Exclude' are supported. + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /** + * list of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Get name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the dimension. + * + * @param name the name value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @param operator the operator value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get list of dimension values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set list of dimension values. + * + * @param values the values value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java new file mode 100644 index 000000000000..de5a2d0f45c7 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricNamespaceName.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The fully qualified metric namespace name. + */ +public class MetricNamespaceName { + /** + * The metric namespace name. + */ + @JsonProperty(value = "metricNamespaceName") + private String metricNamespaceName; + + /** + * Get the metric namespace name. + * + * @return the metricNamespaceName value + */ + public String metricNamespaceName() { + return this.metricNamespaceName; + } + + /** + * Set the metric namespace name. + * + * @param metricNamespaceName the metricNamespaceName value to set + * @return the MetricNamespaceName object itself. + */ + public MetricNamespaceName withMetricNamespaceName(String metricNamespaceName) { + this.metricNamespaceName = metricNamespaceName; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSettings.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSettings.java new file mode 100644 index 000000000000..7986c17e4c14 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricSettings.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + */ +public class MetricSettings { + /** + * the timegrain of the metric in ISO8601 format. + */ + @JsonProperty(value = "timeGrain") + private Period timeGrain; + + /** + * Name of a Diagnostic Metric category for a resource type this setting is + * applied to. To obtain the list of Diagnostic metric categories for a + * resource, first perform a GET diagnostic settings operation. + */ + @JsonProperty(value = "category") + private String category; + + /** + * a value indicating whether this category is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the retention policy for this category. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** + * Get the timegrain of the metric in ISO8601 format. + * + * @return the timeGrain value + */ + public Period timeGrain() { + return this.timeGrain; + } + + /** + * Set the timegrain of the metric in ISO8601 format. + * + * @param timeGrain the timeGrain value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withTimeGrain(Period timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation. + * + * @param category the category value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get a value indicating whether this category is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether this category is enabled. + * + * @param enabled the enabled value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retention policy for this category. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for this category. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricStatisticType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricStatisticType.java new file mode 100644 index 000000000000..53b3373e3a0f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricStatisticType.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for MetricStatisticType. + */ +public enum MetricStatisticType { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Min. */ + MIN("Min"), + + /** Enum value Max. */ + MAX("Max"), + + /** Enum value Sum. */ + SUM("Sum"); + + /** The actual serialized value for a MetricStatisticType instance. */ + private String value; + + MetricStatisticType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MetricStatisticType instance. + * + * @param value the serialized value to parse. + * @return the parsed MetricStatisticType object, or null if unable to parse. + */ + @JsonCreator + public static MetricStatisticType fromString(String value) { + MetricStatisticType[] items = MetricStatisticType.values(); + for (MetricStatisticType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java new file mode 100644 index 000000000000..c97c60f7f457 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java @@ -0,0 +1,235 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The trigger that results in a scaling action. + */ +public class MetricTrigger { + /** + * the name of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * the resource identifier of the resource the rule monitors. + */ + @JsonProperty(value = "metricResourceUri", required = true) + private String metricResourceUri; + + /** + * the granularity of metrics the rule monitors. Must be one of the + * predefined values returned from metric definitions for the metric. Must + * be between 12 hours and 1 minute. + */ + @JsonProperty(value = "timeGrain", required = true) + private Period timeGrain; + + /** + * the metric statistic type. How the metrics from multiple instances are + * combined. Possible values include: 'Average', 'Min', 'Max', 'Sum'. + */ + @JsonProperty(value = "statistic", required = true) + private MetricStatisticType statistic; + + /** + * the range of time in which instance data is collected. This value must + * be greater than the delay in metric collection, which can vary from + * resource-to-resource. Must be between 12 hours and 5 minutes. + */ + @JsonProperty(value = "timeWindow", required = true) + private Period timeWindow; + + /** + * time aggregation type. How the data that is collected should be combined + * over time. The default value is Average. Possible values include: + * 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. + */ + @JsonProperty(value = "timeAggregation", required = true) + private TimeAggregationType timeAggregation; + + /** + * the operator that is used to compare the metric data and the threshold. + * Possible values include: 'Equals', 'NotEquals', 'GreaterThan', + * 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + */ + @JsonProperty(value = "operator", required = true) + private ComparisonOperationType operator; + + /** + * the threshold of the metric that triggers the scale action. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * Get the name of the metric that defines what the rule monitors. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the name of the metric that defines what the rule monitors. + * + * @param metricName the metricName value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the resource identifier of the resource the rule monitors. + * + * @return the metricResourceUri value + */ + public String metricResourceUri() { + return this.metricResourceUri; + } + + /** + * Set the resource identifier of the resource the rule monitors. + * + * @param metricResourceUri the metricResourceUri value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricResourceUri(String metricResourceUri) { + this.metricResourceUri = metricResourceUri; + return this; + } + + /** + * Get the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. + * + * @return the timeGrain value + */ + public Period timeGrain() { + return this.timeGrain; + } + + /** + * Set the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. + * + * @param timeGrain the timeGrain value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeGrain(Period timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'Average', 'Min', 'Max', 'Sum'. + * + * @return the statistic value + */ + public MetricStatisticType statistic() { + return this.statistic; + } + + /** + * Set the metric statistic type. How the metrics from multiple instances are combined. Possible values include: 'Average', 'Min', 'Max', 'Sum'. + * + * @param statistic the statistic value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withStatistic(MetricStatisticType statistic) { + this.statistic = statistic; + return this; + } + + /** + * Get the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. + * + * @return the timeWindow value + */ + public Period timeWindow() { + return this.timeWindow; + } + + /** + * Set the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. + * + * @param timeWindow the timeWindow value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeWindow(Period timeWindow) { + this.timeWindow = timeWindow; + return this; + } + + /** + * Get time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. + * + * @return the timeAggregation value + */ + public TimeAggregationType timeAggregation() { + return this.timeAggregation; + } + + /** + * Set time aggregation type. How the data that is collected should be combined over time. The default value is Average. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Count', 'Last'. + * + * @param timeAggregation the timeAggregation value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeAggregation(TimeAggregationType timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @return the operator value + */ + public ComparisonOperationType operator() { + return this.operator; + } + + /** + * Set the operator that is used to compare the metric data and the threshold. Possible values include: 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @param operator the operator value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withOperator(ComparisonOperationType operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold of the metric that triggers the scale action. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold of the metric that triggers the scale action. + * + * @param threshold the threshold value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java new file mode 100644 index 000000000000..8df88be4b0ec --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MetricTriggerType. + */ +public final class MetricTriggerType extends ExpandableStringEnum { + /** Static value Consecutive for MetricTriggerType. */ + public static final MetricTriggerType CONSECUTIVE = fromString("Consecutive"); + + /** Static value Total for MetricTriggerType. */ + public static final MetricTriggerType TOTAL = fromString("Total"); + + /** + * Creates or finds a MetricTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding MetricTriggerType + */ + @JsonCreator + public static MetricTriggerType fromString(String name) { + return fromString(name, MetricTriggerType.class); + } + + /** + * @return known MetricTriggerType values + */ + public static Collection values() { + return values(MetricTriggerType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricValue.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricValue.java new file mode 100644 index 000000000000..68e1c108574a --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricValue.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a metric value. + */ +public class MetricValue { + /** + * the timestamp for the metric value in ISO 8601 format. + */ + @JsonProperty(value = "timeStamp", required = true) + private DateTime timeStamp; + + /** + * the average value in the time range. + */ + @JsonProperty(value = "average") + private Double average; + + /** + * the least value in the time range. + */ + @JsonProperty(value = "minimum") + private Double minimum; + + /** + * the greatest value in the time range. + */ + @JsonProperty(value = "maximum") + private Double maximum; + + /** + * the sum of all of the values in the time range. + */ + @JsonProperty(value = "total") + private Double total; + + /** + * the number of samples in the time range. Can be used to determine the + * number of values that contributed to the average value. + */ + @JsonProperty(value = "count") + private Long count; + + /** + * Get the timestamp for the metric value in ISO 8601 format. + * + * @return the timeStamp value + */ + public DateTime timeStamp() { + return this.timeStamp; + } + + /** + * Set the timestamp for the metric value in ISO 8601 format. + * + * @param timeStamp the timeStamp value to set + * @return the MetricValue object itself. + */ + public MetricValue withTimeStamp(DateTime timeStamp) { + this.timeStamp = timeStamp; + return this; + } + + /** + * Get the average value in the time range. + * + * @return the average value + */ + public Double average() { + return this.average; + } + + /** + * Set the average value in the time range. + * + * @param average the average value to set + * @return the MetricValue object itself. + */ + public MetricValue withAverage(Double average) { + this.average = average; + return this; + } + + /** + * Get the least value in the time range. + * + * @return the minimum value + */ + public Double minimum() { + return this.minimum; + } + + /** + * Set the least value in the time range. + * + * @param minimum the minimum value to set + * @return the MetricValue object itself. + */ + public MetricValue withMinimum(Double minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the greatest value in the time range. + * + * @return the maximum value + */ + public Double maximum() { + return this.maximum; + } + + /** + * Set the greatest value in the time range. + * + * @param maximum the maximum value to set + * @return the MetricValue object itself. + */ + public MetricValue withMaximum(Double maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the sum of all of the values in the time range. + * + * @return the total value + */ + public Double total() { + return this.total; + } + + /** + * Set the sum of all of the values in the time range. + * + * @param total the total value to set + * @return the MetricValue object itself. + */ + public MetricValue withTotal(Double total) { + this.total = total; + return this; + } + + /** + * Get the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + * + * @return the count value + */ + public Long count() { + return this.count; + } + + /** + * Set the number of samples in the time range. Can be used to determine the number of values that contributed to the average value. + * + * @param count the count value to set + * @return the MetricValue object itself. + */ + public MetricValue withCount(Long count) { + this.count = count; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MultiMetricCriteria.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MultiMetricCriteria.java new file mode 100644 index 000000000000..07b642cb92f9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MultiMetricCriteria.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The types of conditions for a multi resource alert. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("MultiMetricCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "StaticThresholdCriterion", value = MetricCriteria.class) +}) +public class MultiMetricCriteria { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OnboardingStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OnboardingStatus.java new file mode 100644 index 000000000000..617bc5fef59b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OnboardingStatus.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OnboardingStatus. + */ +public final class OnboardingStatus extends ExpandableStringEnum { + /** Static value onboarded for OnboardingStatus. */ + public static final OnboardingStatus ONBOARDED = fromString("onboarded"); + + /** Static value notOnboarded for OnboardingStatus. */ + public static final OnboardingStatus NOT_ONBOARDED = fromString("notOnboarded"); + + /** Static value unknown for OnboardingStatus. */ + public static final OnboardingStatus UNKNOWN = fromString("unknown"); + + /** + * Creates or finds a OnboardingStatus from its string representation. + * @param name a name to look for + * @return the corresponding OnboardingStatus + */ + @JsonCreator + public static OnboardingStatus fromString(String name) { + return fromString(name, OnboardingStatus.class); + } + + /** + * @return known OnboardingStatus values + */ + public static Collection values() { + return values(OnboardingStatus.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OperationDisplay.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OperationDisplay.java new file mode 100644 index 000000000000..96e4c5043b01 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/OperationDisplay.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Insights. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed: AlertRules, Autoscale, + * etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft.Insights. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.Insights. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed: AlertRules, Autoscale, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: AlertRules, Autoscale, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java new file mode 100644 index 000000000000..5f5d1db1f358 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProvisioningState. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deploying for ProvisioningState. */ + public static final ProvisioningState DEPLOYING = fromString("Deploying"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProxyOnlyResource.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProxyOnlyResource.java new file mode 100644 index 000000000000..13dc906b6ce2 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProxyOnlyResource.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.microsoft.azure.ProxyResource; + +/** + * A proxy only azure resource object. + */ +public class ProxyOnlyResource extends ProxyResource { +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java new file mode 100644 index 000000000000..40bbcec076e5 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for QueryType. + */ +public final class QueryType extends ExpandableStringEnum { + /** Static value ResultCount for QueryType. */ + public static final QueryType RESULT_COUNT = fromString("ResultCount"); + + /** + * Creates or finds a QueryType from its string representation. + * @param name a name to look for + * @return the corresponding QueryType + */ + @JsonCreator + public static QueryType fromString(String name) { + return fromString(name, QueryType.class); + } + + /** + * @return known QueryType values + */ + public static Collection values() { + return values(QueryType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ReceiverStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ReceiverStatus.java new file mode 100644 index 000000000000..58c44f62e612 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ReceiverStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReceiverStatus. + */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Recurrence.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Recurrence.java new file mode 100644 index 000000000000..5c0ea3732853 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Recurrence.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The repeating times at which this profile begins. This element is not used + * if the FixedDate element is used. + */ +public class Recurrence { + /** + * the recurrence frequency. How often the schedule profile should take + * effect. This value must be Week, meaning each week will have the same + * set of profiles. For example, to set a daily schedule, set **schedule** + * to every day of the week. The frequency property specifies that the + * schedule is repeated weekly. Possible values include: 'None', 'Second', + * 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'. + */ + @JsonProperty(value = "frequency", required = true) + private RecurrenceFrequency frequency; + + /** + * the scheduling constraints for when the profile begins. + */ + @JsonProperty(value = "schedule", required = true) + private RecurrentSchedule schedule; + + /** + * Get the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'. + * + * @return the frequency value + */ + public RecurrenceFrequency frequency() { + return this.frequency; + } + + /** + * Set the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles. For example, to set a daily schedule, set **schedule** to every day of the week. The frequency property specifies that the schedule is repeated weekly. Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', 'Week', 'Month', 'Year'. + * + * @param frequency the frequency value to set + * @return the Recurrence object itself. + */ + public Recurrence withFrequency(RecurrenceFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the scheduling constraints for when the profile begins. + * + * @return the schedule value + */ + public RecurrentSchedule schedule() { + return this.schedule; + } + + /** + * Set the scheduling constraints for when the profile begins. + * + * @param schedule the schedule value to set + * @return the Recurrence object itself. + */ + public Recurrence withSchedule(RecurrentSchedule schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrenceFrequency.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrenceFrequency.java new file mode 100644 index 000000000000..055c7f35450d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrenceFrequency.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for RecurrenceFrequency. + */ +public enum RecurrenceFrequency { + /** Enum value None. */ + NONE("None"), + + /** Enum value Second. */ + SECOND("Second"), + + /** Enum value Minute. */ + MINUTE("Minute"), + + /** Enum value Hour. */ + HOUR("Hour"), + + /** Enum value Day. */ + DAY("Day"), + + /** Enum value Week. */ + WEEK("Week"), + + /** Enum value Month. */ + MONTH("Month"), + + /** Enum value Year. */ + YEAR("Year"); + + /** The actual serialized value for a RecurrenceFrequency instance. */ + private String value; + + RecurrenceFrequency(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecurrenceFrequency instance. + * + * @param value the serialized value to parse. + * @return the parsed RecurrenceFrequency object, or null if unable to parse. + */ + @JsonCreator + public static RecurrenceFrequency fromString(String value) { + RecurrenceFrequency[] items = RecurrenceFrequency.values(); + for (RecurrenceFrequency item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrentSchedule.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrentSchedule.java new file mode 100644 index 000000000000..5d2bcea88963 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RecurrentSchedule.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The scheduling constraints for when the profile begins. + */ +public class RecurrentSchedule { + /** + * the timezone for the hours of the profile. Some examples of valid time + * zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, + * Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard + * Time, US Mountain Standard Time, Mountain Standard Time (Mexico), + * Mountain Standard Time, Central America Standard Time, Central Standard + * Time, Central Standard Time (Mexico), Canada Central Standard Time, SA + * Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, + * Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, + * Central Brazilian Standard Time, SA Western Standard Time, Pacific SA + * Standard Time, Newfoundland Standard Time, E. South America Standard + * Time, Argentina Standard Time, SA Eastern Standard Time, Greenland + * Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, + * Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard + * Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard + * Time, W. Europe Standard Time, Central Europe Standard Time, Romance + * Standard Time, Central European Standard Time, W. Central Africa + * Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard + * Time, Middle East Standard Time, Egypt Standard Time, Syria Standard + * Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard + * Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard + * Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, + * Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, + * Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, + * Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, + * Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard + * Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard + * Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia + * Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, + * Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, + * China Standard Time, North Asia East Standard Time, Singapore Standard + * Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar + * Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk + * Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, + * E. Australia Standard Time, AUS Eastern Standard Time, West Pacific + * Standard Time, Tasmania Standard Time, Magadan Standard Time, + * Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard + * Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji + * Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa + * Standard Time, Line Islands Standard Time. + */ + @JsonProperty(value = "timeZone", required = true) + private String timeZone; + + /** + * the collection of days that the profile takes effect on. Possible values + * are Sunday through Saturday. + */ + @JsonProperty(value = "days", required = true) + private List days; + + /** + * A collection of hours that the profile takes effect on. Values supported + * are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + */ + @JsonProperty(value = "hours", required = true) + private List hours; + + /** + * A collection of minutes at which the profile takes effect at. + */ + @JsonProperty(value = "minutes", required = true) + private List minutes; + + /** + * Get the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time. + * + * @return the timeZone value + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time. + * + * @param timeZone the timeZone value to set + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + * + * @return the days value + */ + public List days() { + return this.days; + } + + /** + * Set the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + * + * @param days the days value to set + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withDays(List days) { + this.days = days; + return this; + } + + /** + * Get a collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + * + * @return the hours value + */ + public List hours() { + return this.hours; + } + + /** + * Set a collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported). + * + * @param hours the hours value to set + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withHours(List hours) { + this.hours = hours; + return this; + } + + /** + * Get a collection of minutes at which the profile takes effect at. + * + * @return the minutes value + */ + public List minutes() { + return this.minutes; + } + + /** + * Set a collection of minutes at which the profile takes effect at. + * + * @param minutes the minutes value to set + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withMinutes(List minutes) { + this.minutes = minutes; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithError.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithError.java new file mode 100644 index 000000000000..fc4db35cc100 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithError.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An error response from the API. + */ +public class ResponseWithError { + /** + * Error information. + */ + @JsonProperty(value = "error", required = true) + private Error error; + + /** + * Get error information. + * + * @return the error value + */ + public Error error() { + return this.error; + } + + /** + * Set error information. + * + * @param error the error value to set + * @return the ResponseWithError object itself. + */ + public ResponseWithError withError(Error error) { + this.error = error; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithErrorException.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithErrorException.java new file mode 100644 index 000000000000..722bfb65b82c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResponseWithErrorException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ResponseWithError information. + */ +public class ResponseWithErrorException extends RestException { + /** + * Initializes a new instance of the ResponseWithErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ResponseWithErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ResponseWithErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ResponseWithErrorException(final String message, final Response response, final ResponseWithError body) { + super(message, response, body); + } + + @Override + public ResponseWithError body() { + return (ResponseWithError) super.body(); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResultType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResultType.java new file mode 100644 index 000000000000..c70f289b1eec --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ResultType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResultType. + */ +public enum ResultType { + /** Enum value Data. */ + DATA("Data"), + + /** Enum value Metadata. */ + METADATA("Metadata"); + + /** The actual serialized value for a ResultType instance. */ + private String value; + + ResultType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResultType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResultType object, or null if unable to parse. + */ + @JsonCreator + public static ResultType fromString(String value) { + ResultType[] items = ResultType.values(); + for (ResultType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RetentionPolicy.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RetentionPolicy.java new file mode 100644 index 000000000000..8698ae009272 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RetentionPolicy.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the retention policy for the log. + */ +public class RetentionPolicy { + /** + * a value indicating whether the retention policy is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the number of days for the retention in days. A value of 0 will retain + * the events indefinitely. + */ + @JsonProperty(value = "days", required = true) + private int days; + + /** + * Get a value indicating whether the retention policy is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether the retention policy is enabled. + * + * @param enabled the enabled value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @return the days value + */ + public int days() { + return this.days; + } + + /** + * Set the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @param days the days value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withDays(int days) { + this.days = days; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleAction.java new file mode 100644 index 000000000000..5ddd134d421f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleAction.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleAction") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", value = RuleEmailAction.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", value = RuleWebhookAction.class) +}) +public class RuleAction { +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleCondition.java new file mode 100644 index 000000000000..0e8c57bde82c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleCondition.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The condition that results in the alert rule being activated. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleCondition") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", value = ThresholdRuleCondition.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", value = LocationThresholdRuleCondition.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition", value = ManagementEventRuleCondition.class) +}) +public class RuleCondition { + /** + * the resource from which the rule collects its data. For this type + * dataSource will always be of type RuleMetricDataSource. + */ + @JsonProperty(value = "dataSource") + private RuleDataSource dataSource; + + /** + * Get the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + * + * @return the dataSource value + */ + public RuleDataSource dataSource() { + return this.dataSource; + } + + /** + * Set the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + * + * @param dataSource the dataSource value to set + * @return the RuleCondition object itself. + */ + public RuleCondition withDataSource(RuleDataSource dataSource) { + this.dataSource = dataSource; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleDataSource.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleDataSource.java new file mode 100644 index 000000000000..ecb94a040fd1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleDataSource.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The resource from which the rule collects its data. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleDataSource") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", value = RuleMetricDataSource.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource", value = RuleManagementEventDataSource.class) +}) +public class RuleDataSource { + /** + * the resource identifier of the resource the rule monitors. **NOTE**: + * this property cannot be updated for an existing rule. + */ + @JsonProperty(value = "resourceUri") + private String resourceUri; + + /** + * Get the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Set the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + * + * @param resourceUri the resourceUri value to set + * @return the RuleDataSource object itself. + */ + public RuleDataSource withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleEmailAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleEmailAction.java new file mode 100644 index 000000000000..5649ad2f29d0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleEmailAction.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleEmailAction") +public class RuleEmailAction extends RuleAction { + /** + * Whether the administrators (service and co-administrators) of the + * service should be notified when the alert is activated. + */ + @JsonProperty(value = "sendToServiceOwners") + private Boolean sendToServiceOwners; + + /** + * the list of administrator's custom email addresses to notify of the + * activation of the alert. + */ + @JsonProperty(value = "customEmails") + private List customEmails; + + /** + * Get whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + * + * @return the sendToServiceOwners value + */ + public Boolean sendToServiceOwners() { + return this.sendToServiceOwners; + } + + /** + * Set whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + * + * @param sendToServiceOwners the sendToServiceOwners value to set + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withSendToServiceOwners(Boolean sendToServiceOwners) { + this.sendToServiceOwners = sendToServiceOwners; + return this; + } + + /** + * Get the list of administrator's custom email addresses to notify of the activation of the alert. + * + * @return the customEmails value + */ + public List customEmails() { + return this.customEmails; + } + + /** + * Set the list of administrator's custom email addresses to notify of the activation of the alert. + * + * @param customEmails the customEmails value to set + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withCustomEmails(List customEmails) { + this.customEmails = customEmails; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventClaimsDataSource.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventClaimsDataSource.java new file mode 100644 index 000000000000..903611e65630 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventClaimsDataSource.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The claims for a rule management event data source. + */ +public class RuleManagementEventClaimsDataSource { + /** + * the email address. + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /** + * Get the email address. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address. + * + * @param emailAddress the emailAddress value to set + * @return the RuleManagementEventClaimsDataSource object itself. + */ + public RuleManagementEventClaimsDataSource withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventDataSource.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventDataSource.java new file mode 100644 index 000000000000..166ecad36d53 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleManagementEventDataSource.java @@ -0,0 +1,258 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource") +public class RuleManagementEventDataSource extends RuleDataSource { + /** + * the event name. + */ + @JsonProperty(value = "eventName") + private String eventName; + + /** + * the event source. + */ + @JsonProperty(value = "eventSource") + private String eventSource; + + /** + * the level. + */ + @JsonProperty(value = "level") + private String level; + + /** + * The name of the operation that should be checked for. If no name is + * provided, any operation will match. + */ + @JsonProperty(value = "operationName") + private String operationName; + + /** + * the resource group name. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * the resource provider name. + */ + @JsonProperty(value = "resourceProviderName") + private String resourceProviderName; + + /** + * The status of the operation that should be checked for. If no status is + * provided, any status will match. + */ + @JsonProperty(value = "status") + private String status; + + /** + * the substatus. + */ + @JsonProperty(value = "subStatus") + private String subStatus; + + /** + * the claims. + */ + @JsonProperty(value = "claims") + private RuleManagementEventClaimsDataSource claims; + + /** + * Get the event name. + * + * @return the eventName value + */ + public String eventName() { + return this.eventName; + } + + /** + * Set the event name. + * + * @param eventName the eventName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the event source. + * + * @return the eventSource value + */ + public String eventSource() { + return this.eventSource; + } + + /** + * Set the event source. + * + * @param eventSource the eventSource value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventSource(String eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the level. + * + * @return the level value + */ + public String level() { + return this.level; + } + + /** + * Set the level. + * + * @param level the level value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withLevel(String level) { + this.level = level; + return this; + } + + /** + * Get the name of the operation that should be checked for. If no name is provided, any operation will match. + * + * @return the operationName value + */ + public String operationName() { + return this.operationName; + } + + /** + * Set the name of the operation that should be checked for. If no name is provided, any operation will match. + * + * @param operationName the operationName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withOperationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Get the resource group name. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resource group name. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the resource provider name. + * + * @return the resourceProviderName value + */ + public String resourceProviderName() { + return this.resourceProviderName; + } + + /** + * Set the resource provider name. + * + * @param resourceProviderName the resourceProviderName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceProviderName(String resourceProviderName) { + this.resourceProviderName = resourceProviderName; + return this; + } + + /** + * Get the status of the operation that should be checked for. If no status is provided, any status will match. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the operation that should be checked for. If no status is provided, any status will match. + * + * @param status the status value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the substatus. + * + * @return the subStatus value + */ + public String subStatus() { + return this.subStatus; + } + + /** + * Set the substatus. + * + * @param subStatus the subStatus value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withSubStatus(String subStatus) { + this.subStatus = subStatus; + return this; + } + + /** + * Get the claims. + * + * @return the claims value + */ + public RuleManagementEventClaimsDataSource claims() { + return this.claims; + } + + /** + * Set the claims. + * + * @param claims the claims value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withClaims(RuleManagementEventClaimsDataSource claims) { + this.claims = claims; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleMetricDataSource.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleMetricDataSource.java new file mode 100644 index 000000000000..d85cef131a6a --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleMetricDataSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource") +public class RuleMetricDataSource extends RuleDataSource { + /** + * the name of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricName") + private String metricName; + + /** + * Get the name of the metric that defines what the rule monitors. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the name of the metric that defines what the rule monitors. + * + * @param metricName the metricName value to set + * @return the RuleMetricDataSource object itself. + */ + public RuleMetricDataSource withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleWebhookAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleWebhookAction.java new file mode 100644 index 000000000000..aab4785db704 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/RuleWebhookAction.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleWebhookAction") +public class RuleWebhookAction extends RuleAction { + /** + * the service uri to Post the notification when the alert activates or + * resolves. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * the dictionary of custom properties to include with the post operation. + * These data are appended to the webhook payload. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Get the service uri to Post the notification when the alert activates or resolves. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service uri to Post the notification when the alert activates or resolves. + * + * @param serviceUri the serviceUri value to set + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @param properties the properties value to set + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleAction.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleAction.java new file mode 100644 index 000000000000..b9e9f76e8ebd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleAction.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters for the scaling action. + */ +public class ScaleAction { + /** + * the scale direction. Whether the scaling action increases or decreases + * the number of instances. Possible values include: 'None', 'Increase', + * 'Decrease'. + */ + @JsonProperty(value = "direction", required = true) + private ScaleDirection direction; + + /** + * the type of action that should occur when the scale rule fires. Possible + * values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount'. + */ + @JsonProperty(value = "type", required = true) + private ScaleType type; + + /** + * the number of instances that are involved in the scaling action. This + * value must be 1 or greater. The default value is 1. + */ + @JsonProperty(value = "value") + private String value; + + /** + * the amount of time to wait since the last scaling action before this + * action occurs. It must be between 1 week and 1 minute in ISO 8601 + * format. + */ + @JsonProperty(value = "cooldown", required = true) + private Period cooldown; + + /** + * Get the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'None', 'Increase', 'Decrease'. + * + * @return the direction value + */ + public ScaleDirection direction() { + return this.direction; + } + + /** + * Set the scale direction. Whether the scaling action increases or decreases the number of instances. Possible values include: 'None', 'Increase', 'Decrease'. + * + * @param direction the direction value to set + * @return the ScaleAction object itself. + */ + public ScaleAction withDirection(ScaleDirection direction) { + this.direction = direction; + return this; + } + + /** + * Get the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount'. + * + * @return the type value + */ + public ScaleType type() { + return this.type; + } + + /** + * Set the type of action that should occur when the scale rule fires. Possible values include: 'ChangeCount', 'PercentChangeCount', 'ExactCount'. + * + * @param type the type value to set + * @return the ScaleAction object itself. + */ + public ScaleAction withType(ScaleType type) { + this.type = type; + return this; + } + + /** + * Get the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is 1. + * + * @param value the value value to set + * @return the ScaleAction object itself. + */ + public ScaleAction withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. + * + * @return the cooldown value + */ + public Period cooldown() { + return this.cooldown; + } + + /** + * Set the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week and 1 minute in ISO 8601 format. + * + * @param cooldown the cooldown value to set + * @return the ScaleAction object itself. + */ + public ScaleAction withCooldown(Period cooldown) { + this.cooldown = cooldown; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleCapacity.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleCapacity.java new file mode 100644 index 000000000000..67d7b31e9299 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleCapacity.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The number of instances that can be used during this profile. + */ +public class ScaleCapacity { + /** + * the minimum number of instances for the resource. + */ + @JsonProperty(value = "minimum", required = true) + private String minimum; + + /** + * the maximum number of instances for the resource. The actual maximum + * number of instances is limited by the cores that are available in the + * subscription. + */ + @JsonProperty(value = "maximum", required = true) + private String maximum; + + /** + * the number of instances that will be set if metrics are not available + * for evaluation. The default is only used if the current instance count + * is lower than the default. + */ + @JsonProperty(value = "default", required = true) + private String defaultProperty; + + /** + * Get the minimum number of instances for the resource. + * + * @return the minimum value + */ + public String minimum() { + return this.minimum; + } + + /** + * Set the minimum number of instances for the resource. + * + * @param minimum the minimum value to set + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withMinimum(String minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. + * + * @return the maximum value + */ + public String maximum() { + return this.maximum; + } + + /** + * Set the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores that are available in the subscription. + * + * @param maximum the maximum value to set + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withMaximum(String maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. + * + * @return the defaultProperty value + */ + public String defaultProperty() { + return this.defaultProperty; + } + + /** + * Set the number of instances that will be set if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default. + * + * @param defaultProperty the defaultProperty value to set + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withDefaultProperty(String defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleDirection.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleDirection.java new file mode 100644 index 000000000000..56ebb3cdd2b8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleDirection.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ScaleDirection. + */ +public enum ScaleDirection { + /** Enum value None. */ + NONE("None"), + + /** Enum value Increase. */ + INCREASE("Increase"), + + /** Enum value Decrease. */ + DECREASE("Decrease"); + + /** The actual serialized value for a ScaleDirection instance. */ + private String value; + + ScaleDirection(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScaleDirection instance. + * + * @param value the serialized value to parse. + * @return the parsed ScaleDirection object, or null if unable to parse. + */ + @JsonCreator + public static ScaleDirection fromString(String value) { + ScaleDirection[] items = ScaleDirection.values(); + for (ScaleDirection item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleRule.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleRule.java new file mode 100644 index 000000000000..bb3d830d2496 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleRule.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule that provide the triggers and parameters for the scaling action. + */ +public class ScaleRule { + /** + * the trigger that results in a scaling action. + */ + @JsonProperty(value = "metricTrigger", required = true) + private MetricTrigger metricTrigger; + + /** + * the parameters for the scaling action. + */ + @JsonProperty(value = "scaleAction", required = true) + private ScaleAction scaleAction; + + /** + * Get the trigger that results in a scaling action. + * + * @return the metricTrigger value + */ + public MetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set the trigger that results in a scaling action. + * + * @param metricTrigger the metricTrigger value to set + * @return the ScaleRule object itself. + */ + public ScaleRule withMetricTrigger(MetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + + /** + * Get the parameters for the scaling action. + * + * @return the scaleAction value + */ + public ScaleAction scaleAction() { + return this.scaleAction; + } + + /** + * Set the parameters for the scaling action. + * + * @param scaleAction the scaleAction value to set + * @return the ScaleRule object itself. + */ + public ScaleRule withScaleAction(ScaleAction scaleAction) { + this.scaleAction = scaleAction; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleType.java new file mode 100644 index 000000000000..b11ed7580597 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ScaleType.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ScaleType. + */ +public enum ScaleType { + /** Enum value ChangeCount. */ + CHANGE_COUNT("ChangeCount"), + + /** Enum value PercentChangeCount. */ + PERCENT_CHANGE_COUNT("PercentChangeCount"), + + /** Enum value ExactCount. */ + EXACT_COUNT("ExactCount"); + + /** The actual serialized value for a ScaleType instance. */ + private String value; + + ScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed ScaleType object, or null if unable to parse. + */ + @JsonCreator + public static ScaleType fromString(String value) { + ScaleType[] items = ScaleType.values(); + for (ScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java new file mode 100644 index 000000000000..a30f11d0cbcc --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines how often to run the search and the time interval. + */ +public class Schedule { + /** + * frequency (in minutes) at which rule condition should be evaluated. + */ + @JsonProperty(value = "frequencyInMinutes", required = true) + private int frequencyInMinutes; + + /** + * Time window for which data needs to be fetched for query (should be + * greater than or equal to frequencyInMinutes). + */ + @JsonProperty(value = "timeWindowInMinutes", required = true) + private int timeWindowInMinutes; + + /** + * Get frequency (in minutes) at which rule condition should be evaluated. + * + * @return the frequencyInMinutes value + */ + public int frequencyInMinutes() { + return this.frequencyInMinutes; + } + + /** + * Set frequency (in minutes) at which rule condition should be evaluated. + * + * @param frequencyInMinutes the frequencyInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withFrequencyInMinutes(int frequencyInMinutes) { + this.frequencyInMinutes = frequencyInMinutes; + return this; + } + + /** + * Get time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). + * + * @return the timeWindowInMinutes value + */ + public int timeWindowInMinutes() { + return this.timeWindowInMinutes; + } + + /** + * Set time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). + * + * @param timeWindowInMinutes the timeWindowInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withTimeWindowInMinutes(int timeWindowInMinutes) { + this.timeWindowInMinutes = timeWindowInMinutes; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SenderAuthorization.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SenderAuthorization.java new file mode 100644 index 000000000000..422be463be0c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SenderAuthorization.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * the authorization used by the user who has performed the operation that led + * to this event. This captures the RBAC properties of the event. These usually + * include the 'action', 'role' and the 'scope'. + */ +public class SenderAuthorization { + /** + * the permissible actions. For instance: + * microsoft.support/supporttickets/write. + */ + @JsonProperty(value = "action") + private String action; + + /** + * the role of the user. For instance: Subscription Admin. + */ + @JsonProperty(value = "role") + private String role; + + /** + * the scope. + */ + @JsonProperty(value = "scope") + private String scope; + + /** + * Get the permissible actions. For instance: microsoft.support/supporttickets/write. + * + * @return the action value + */ + public String action() { + return this.action; + } + + /** + * Set the permissible actions. For instance: microsoft.support/supporttickets/write. + * + * @param action the action value to set + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withAction(String action) { + this.action = action; + return this; + } + + /** + * Get the role of the user. For instance: Subscription Admin. + * + * @return the role value + */ + public String role() { + return this.role; + } + + /** + * Set the role of the user. For instance: Subscription Admin. + * + * @param role the role value to set + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withRole(String role) { + this.role = role; + return this; + } + + /** + * Get the scope. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope. + * + * @param scope the scope value to set + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withScope(String scope) { + this.scope = scope; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sensitivity.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sensitivity.java new file mode 100644 index 000000000000..e1604a380ba0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sensitivity.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Sensitivity. + */ +public enum Sensitivity { + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"); + + /** The actual serialized value for a Sensitivity instance. */ + private String value; + + Sensitivity(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Sensitivity instance. + * + * @param value the serialized value to parse. + * @return the parsed Sensitivity object, or null if unable to parse. + */ + @JsonCreator + public static Sensitivity fromString(String value) { + Sensitivity[] items = Sensitivity.values(); + for (Sensitivity item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SmsReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SmsReceiver.java new file mode 100644 index 000000000000..5fc16fcc1b4d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SmsReceiver.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An SMS receiver. + */ +public class SmsReceiver { + /** + * The name of the SMS receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * The status of the receiver. Possible values include: 'NotSpecified', + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the SMS receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the SMS receiver. + * + * @param countryCode the countryCode value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the SMS receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java new file mode 100644 index 000000000000..951bfaec1238 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the log search query. + */ +public class Source { + /** + * Log search query. Required for action type - AlertingAction. + */ + @JsonProperty(value = "query") + private String query; + + /** + * List of Resource referred into query. + */ + @JsonProperty(value = "authorizedResources") + private List authorizedResources; + + /** + * The resource uri over which log search query is to be run. + */ + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; + + /** + * Set value to 'ResultCount'. Possible values include: 'ResultCount'. + */ + @JsonProperty(value = "queryType") + private QueryType queryType; + + /** + * Get log search query. Required for action type - AlertingAction. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set log search query. Required for action type - AlertingAction. + * + * @param query the query value to set + * @return the Source object itself. + */ + public Source withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get list of Resource referred into query. + * + * @return the authorizedResources value + */ + public List authorizedResources() { + return this.authorizedResources; + } + + /** + * Set list of Resource referred into query. + * + * @param authorizedResources the authorizedResources value to set + * @return the Source object itself. + */ + public Source withAuthorizedResources(List authorizedResources) { + this.authorizedResources = authorizedResources; + return this; + } + + /** + * Get the resource uri over which log search query is to be run. + * + * @return the dataSourceId value + */ + public String dataSourceId() { + return this.dataSourceId; + } + + /** + * Set the resource uri over which log search query is to be run. + * + * @param dataSourceId the dataSourceId value to set + * @return the Source object itself. + */ + public Source withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; + return this; + } + + /** + * Get set value to 'ResultCount'. Possible values include: 'ResultCount'. + * + * @return the queryType value + */ + public QueryType queryType() { + return this.queryType; + } + + /** + * Set set value to 'ResultCount'. Possible values include: 'ResultCount'. + * + * @param queryType the queryType value to set + * @return the Source object itself. + */ + public Source withQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ThresholdRuleCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ThresholdRuleCondition.java new file mode 100644 index 000000000000..e673d96f13a4 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ThresholdRuleCondition.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule condition based on a metric crossing a threshold. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition") +public class ThresholdRuleCondition extends RuleCondition { + /** + * the operator used to compare the data and the threshold. Possible values + * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual'. + */ + @JsonProperty(value = "operator", required = true) + private ConditionOperator operator; + + /** + * the threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * the time aggregation operator. How the data that are collected should be + * combined over time. The default value is the PrimaryAggregationType of + * the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', + * 'Total', 'Last'. + */ + @JsonProperty(value = "timeAggregation") + private TimeAggregationOperator timeAggregation; + + /** + * Get the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @return the operator value + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @param operator the operator value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold value that activates the alert. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last'. + * + * @return the timeAggregation value + */ + public TimeAggregationOperator timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last'. + * + * @param timeAggregation the timeAggregation value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withTimeAggregation(TimeAggregationOperator timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationOperator.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationOperator.java new file mode 100644 index 000000000000..368433fd3b09 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationOperator.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TimeAggregationOperator. + */ +public enum TimeAggregationOperator { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"), + + /** Enum value Last. */ + LAST("Last"); + + /** The actual serialized value for a TimeAggregationOperator instance. */ + private String value; + + TimeAggregationOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TimeAggregationOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed TimeAggregationOperator object, or null if unable to parse. + */ + @JsonCreator + public static TimeAggregationOperator fromString(String value) { + TimeAggregationOperator[] items = TimeAggregationOperator.values(); + for (TimeAggregationOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java new file mode 100644 index 000000000000..5130730d98fe --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeAggregationType.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TimeAggregationType. + */ +public enum TimeAggregationType { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"), + + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Last. */ + LAST("Last"); + + /** The actual serialized value for a TimeAggregationType instance. */ + private String value; + + TimeAggregationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TimeAggregationType instance. + * + * @param value the serialized value to parse. + * @return the parsed TimeAggregationType object, or null if unable to parse. + */ + @JsonCreator + public static TimeAggregationType fromString(String value) { + TimeAggregationType[] items = TimeAggregationType.values(); + for (TimeAggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesElement.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesElement.java new file mode 100644 index 000000000000..5fc088d2dd31 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesElement.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A time series result type. The discriminator value is always TimeSeries in + * this case. + */ +public class TimeSeriesElement { + /** + * the metadata values returned if $filter was specified in the call. + */ + @JsonProperty(value = "metadatavalues") + private List metadatavalues; + + /** + * An array of data points representing the metric values. This is only + * returned if a result type of data is specified. + */ + @JsonProperty(value = "data") + private List data; + + /** + * Get the metadata values returned if $filter was specified in the call. + * + * @return the metadatavalues value + */ + public List metadatavalues() { + return this.metadatavalues; + } + + /** + * Set the metadata values returned if $filter was specified in the call. + * + * @param metadatavalues the metadatavalues value to set + * @return the TimeSeriesElement object itself. + */ + public TimeSeriesElement withMetadatavalues(List metadatavalues) { + this.metadatavalues = metadatavalues; + return this; + } + + /** + * Get an array of data points representing the metric values. This is only returned if a result type of data is specified. + * + * @return the data value + */ + public List data() { + return this.data; + } + + /** + * Set an array of data points representing the metric values. This is only returned if a result type of data is specified. + * + * @param data the data value to set + * @return the TimeSeriesElement object itself. + */ + public TimeSeriesElement withData(List data) { + this.data = data; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java new file mode 100644 index 000000000000..9c343dff1269 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeSeriesInformation.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The time series info needed for calculating the baseline. + */ +public class TimeSeriesInformation { + /** + * the list of sensitivities for calculating the baseline. + */ + @JsonProperty(value = "sensitivities", required = true) + private List sensitivities; + + /** + * The metric values to calculate the baseline. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * the array of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps") + private List timestamps; + + /** + * Get the list of sensitivities for calculating the baseline. + * + * @return the sensitivities value + */ + public List sensitivities() { + return this.sensitivities; + } + + /** + * Set the list of sensitivities for calculating the baseline. + * + * @param sensitivities the sensitivities value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withSensitivities(List sensitivities) { + this.sensitivities = sensitivities; + return this; + } + + /** + * Get the metric values to calculate the baseline. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the metric values to calculate the baseline. + * + * @param values the values value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeWindow.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeWindow.java new file mode 100644 index 000000000000..070bfe6f7e2d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TimeWindow.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A specific date-time for the profile. + */ +public class TimeWindow { + /** + * the timezone of the start and end times for the profile. Some examples + * of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian + * Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), + * Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time + * (Mexico), Mountain Standard Time, Central America Standard Time, Central + * Standard Time, Central Standard Time (Mexico), Canada Central Standard + * Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern + * Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic + * Standard Time, Central Brazilian Standard Time, SA Western Standard + * Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South + * America Standard Time, Argentina Standard Time, SA Eastern Standard + * Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard + * Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape + * Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, + * Greenwich Standard Time, W. Europe Standard Time, Central Europe + * Standard Time, Romance Standard Time, Central European Standard Time, W. + * Central Africa Standard Time, Namibia Standard Time, Jordan Standard + * Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, + * Syria Standard Time, E. Europe Standard Time, South Africa Standard + * Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, + * Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, + * Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. + * Africa Standard Time, Iran Standard Time, Arabian Standard Time, + * Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, + * Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard + * Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan + * Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal + * Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. + * Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard + * Time, North Asia Standard Time, China Standard Time, North Asia East + * Standard Time, Singapore Standard Time, W. Australia Standard Time, + * Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, + * Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard + * Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern + * Standard Time, West Pacific Standard Time, Tasmania Standard Time, + * Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, + * Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard + * Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga + * Standard Time, Samoa Standard Time, Line Islands Standard Time. + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /** + * the start time for the profile in ISO 8601 format. + */ + @JsonProperty(value = "start", required = true) + private DateTime start; + + /** + * the end time for the profile in ISO 8601 format. + */ + @JsonProperty(value = "end", required = true) + private DateTime end; + + /** + * Get the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time. + * + * @return the timeZone value + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard Time, Central Standard Time, Central Standard Time (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time. + * + * @param timeZone the timeZone value to set + * @return the TimeWindow object itself. + */ + public TimeWindow withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the start time for the profile in ISO 8601 format. + * + * @return the start value + */ + public DateTime start() { + return this.start; + } + + /** + * Set the start time for the profile in ISO 8601 format. + * + * @param start the start value to set + * @return the TimeWindow object itself. + */ + public TimeWindow withStart(DateTime start) { + this.start = start; + return this; + } + + /** + * Get the end time for the profile in ISO 8601 format. + * + * @return the end value + */ + public DateTime end() { + return this.end; + } + + /** + * Set the end time for the profile in ISO 8601 format. + * + * @param end the end value to set + * @return the TimeWindow object itself. + */ + public TimeWindow withEnd(DateTime end) { + this.end = end; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java new file mode 100644 index 000000000000..9cea16885168 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The condition that results in the Log Search rule. + */ +public class TriggerCondition { + /** + * Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible + * values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator", required = true) + private ConditionalOperator thresholdOperator; + + /** + * Result or count threshold based on which rule should be triggered. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * Trigger condition for metric query rule. + */ + @JsonProperty(value = "metricTrigger") + private LogMetricTrigger metricTrigger; + + /** + * Get evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get result or count threshold based on which rule should be triggered. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set result or count threshold based on which rule should be triggered. + * + * @param threshold the threshold value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get trigger condition for metric query rule. + * + * @return the metricTrigger value + */ + public LogMetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set trigger condition for metric query rule. + * + * @param metricTrigger the metricTrigger value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withMetricTrigger(LogMetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Unit.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Unit.java new file mode 100644 index 000000000000..38c3b3bf2a6e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Unit.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Unit. + */ +public enum Unit { + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Bytes. */ + BYTES("Bytes"), + + /** Enum value Seconds. */ + SECONDS("Seconds"), + + /** Enum value CountPerSecond. */ + COUNT_PER_SECOND("CountPerSecond"), + + /** Enum value BytesPerSecond. */ + BYTES_PER_SECOND("BytesPerSecond"), + + /** Enum value Percent. */ + PERCENT("Percent"), + + /** Enum value MilliSeconds. */ + MILLI_SECONDS("MilliSeconds"), + + /** Enum value ByteSeconds. */ + BYTE_SECONDS("ByteSeconds"), + + /** Enum value Unspecified. */ + UNSPECIFIED("Unspecified"); + + /** The actual serialized value for a Unit instance. */ + private String value; + + Unit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Unit instance. + * + * @param value the serialized value to parse. + * @return the parsed Unit object, or null if unable to parse. + */ + @JsonCreator + public static Unit fromString(String value) { + Unit[] items = Unit.values(); + for (Unit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java new file mode 100644 index 000000000000..8336ac05ccd5 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/VoiceReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A voice receiver. + */ +public class VoiceReceiver { + /** + * The name of the voice receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the voice receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the voice receiver. + * + * @param countryCode the countryCode value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the voice receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the voice receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookNotification.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookNotification.java new file mode 100644 index 000000000000..f491e8d937c3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookNotification.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Webhook notification of an autoscale event. + */ +public class WebhookNotification { + /** + * the service address to receive the notification. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * a property bag of settings. This value can be empty. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Get the service address to receive the notification. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service address to receive the notification. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookNotification object itself. + */ + public WebhookNotification withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get a property bag of settings. This value can be empty. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set a property bag of settings. This value can be empty. + * + * @param properties the properties value to set + * @return the WebhookNotification object itself. + */ + public WebhookNotification withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookReceiver.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookReceiver.java new file mode 100644 index 000000000000..82d530c45ce8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WebhookReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A webhook receiver. + */ +public class WebhookReceiver { + /** + * The name of the webhook receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /** + * Get the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WorkspaceInfo.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WorkspaceInfo.java new file mode 100644 index 000000000000..d8891073bfca --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/WorkspaceInfo.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Information about a Log Analytics Workspace. + */ +@JsonFlatten +public class WorkspaceInfo { + /** + * Azure Resource Manager identifier of the Log Analytics Workspace. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Location of the Log Analytics workspace. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Log Analytics workspace identifier. + */ + @JsonProperty(value = "properties.customerId", required = true) + private String customerId; + + /** + * Get azure Resource Manager identifier of the Log Analytics Workspace. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set azure Resource Manager identifier of the Log Analytics Workspace. + * + * @param id the id value to set + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get location of the Log Analytics workspace. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location of the Log Analytics workspace. + * + * @param location the location value to set + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get log Analytics workspace identifier. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Set log Analytics workspace identifier. + * + * @param customerId the customerId value to set + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withCustomerId(String customerId) { + this.customerId = customerId; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java new file mode 100644 index 000000000000..0699ab0f63c5 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupResourceInner.java @@ -0,0 +1,346 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.EmailReceiver; +import com.microsoft.azure.management.monitor.SmsReceiver; +import com.microsoft.azure.management.monitor.WebhookReceiver; +import com.microsoft.azure.management.monitor.ItsmReceiver; +import com.microsoft.azure.management.monitor.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.VoiceReceiver; +import com.microsoft.azure.management.monitor.LogicAppReceiver; +import com.microsoft.azure.management.monitor.AzureFunctionReceiver; +import com.microsoft.azure.management.monitor.ArmRoleReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An action group resource. + */ +@JsonFlatten +public class ActionGroupResourceInner extends Resource { + /** + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "properties.groupShortName", required = true) + private String groupShortName; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its receivers will receive communications. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "properties.emailReceivers") + private List emailReceivers; + + /** + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "properties.smsReceivers") + private List smsReceivers; + + /** + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "properties.webhookReceivers") + private List webhookReceivers; + + /** + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "properties.itsmReceivers") + private List itsmReceivers; + + /** + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureAppPushReceivers") + private List azureAppPushReceivers; + + /** + * The list of AutomationRunbook receivers that are part of this action + * group. + */ + @JsonProperty(value = "properties.automationRunbookReceivers") + private List automationRunbookReceivers; + + /** + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "properties.voiceReceivers") + private List voiceReceivers; + + /** + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "properties.logicAppReceivers") + private List logicAppReceivers; + + /** + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureFunctionReceivers") + private List azureFunctionReceivers; + + /** + * The list of ARM role receivers that are part of this action group. Roles + * are Azure RBAC roles and only built-in roles are supported. + */ + @JsonProperty(value = "properties.armRoleReceivers") + private List armRoleReceivers; + + /** + * Get the short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of email receivers that are part of this action group. + * + * @return the emailReceivers value + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the list of AutomationRunbook receivers that are part of this action group. + * + * @return the automationRunbookReceivers value + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the list of AutomationRunbook receivers that are part of this action group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + + /** + * Get the list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + + /** + * Get the list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + * + * @return the armRoleReceivers value + */ + public List armRoleReceivers() { + return this.armRoleReceivers; + } + + /** + * Set the list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + * + * @param armRoleReceivers the armRoleReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java new file mode 100644 index 000000000000..a3118ffea7fb --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActionGroupsInner.java @@ -0,0 +1,709 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ActionGroupPatchBody; +import com.microsoft.azure.management.monitor.EnableRequest; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActionGroups. + */ +public class ActionGroupsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActionGroupsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActionGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActionGroupsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActionGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActionGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ActionGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Body ActionGroupResourceInner actionGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBody actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActionGroups enableReceiver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") + Observable> enableReceiver(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body EnableRequest enableRequest, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner createOrUpdate(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).toBlocking().single().body(); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup), serviceCallback); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (actionGroup == null) { + throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); + } + Validator.validate(actionGroup); + final String apiVersion = "2018-09-01"; + return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01"; + return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String actionGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String actionGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01"; + return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).toBlocking().single().body(); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch), serviceCallback); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (actionGroupPatch == null) { + throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); + } + Validator.validate(actionGroupPatch); + final String apiVersion = "2018-09-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, apiVersion, actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-09-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableReceiver(String resourceGroupName, String actionGroupName, String receiverName) { + enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).toBlocking().single().body(); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName), serviceCallback); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + return enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableReceiverWithServiceResponseAsync(String resourceGroupName, String actionGroupName, String receiverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (receiverName == null) { + throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); + } + final String apiVersion = "2018-09-01"; + EnableRequest enableRequest = new EnableRequest(); + enableRequest.withReceiverName(receiverName); + return service.enableReceiver(resourceGroupName, actionGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), enableRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableReceiverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableReceiverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertResourceInner.java new file mode 100644 index 000000000000..5b68fc0b9591 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertResourceInner.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.ActivityLogAlertAllOfCondition; +import com.microsoft.azure.management.monitor.ActivityLogAlertActionList; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An activity log alert resource. + */ +@JsonFlatten +public class ActivityLogAlertResourceInner extends Resource { + /** + * A list of resourceIds that will be used as prefixes. The alert will only + * apply to activityLogs with resourceIds that fall under one of these + * prefixes. This list must include at least one item. + */ + @JsonProperty(value = "properties.scopes", required = true) + private List scopes; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * The condition that will cause this alert to activate. + */ + @JsonProperty(value = "properties.condition", required = true) + private ActivityLogAlertAllOfCondition condition; + + /** + * The actions that will activate when the condition is met. + */ + @JsonProperty(value = "properties.actions", required = true) + private ActivityLogAlertActionList actions; + + /** + * A description of this activity log alert. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Get a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @param scopes the scopes value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the condition that will cause this alert to activate. + * + * @return the condition value + */ + public ActivityLogAlertAllOfCondition condition() { + return this.condition; + } + + /** + * Set the condition that will cause this alert to activate. + * + * @param condition the condition value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withCondition(ActivityLogAlertAllOfCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions that will activate when the condition is met. + * + * @return the actions value + */ + public ActivityLogAlertActionList actions() { + return this.actions; + } + + /** + * Set the actions that will activate when the condition is met. + * + * @param actions the actions value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withActions(ActivityLogAlertActionList actions) { + this.actions = actions; + return this; + } + + /** + * Get a description of this activity log alert. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set a description of this activity log alert. + * + * @param description the description value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java new file mode 100644 index 000000000000..96f44fc6d2fa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogAlertsInner.java @@ -0,0 +1,610 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ActivityLogAlertPatchBody; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActivityLogAlerts. + */ +public class ActivityLogAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActivityLogAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActivityLogAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActivityLogAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActivityLogAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActivityLogAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface ActivityLogAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertResourceInner activityLogAlert, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertPatchBody activityLogAlertPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner createOrUpdate(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).toBlocking().single().body(); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert), serviceCallback); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (activityLogAlert == null) { + throw new IllegalArgumentException("Parameter activityLogAlert is required and cannot be null."); + } + Validator.validate(activityLogAlert); + final String apiVersion = "2017-04-01"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, apiVersion, activityLogAlert, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + final String apiVersion = "2017-04-01"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String activityLogAlertName) { + deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String activityLogAlertName) { + return deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + final String apiVersion = "2017-04-01"; + return service.delete(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner update(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).toBlocking().single().body(); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch), serviceCallback); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (activityLogAlertPatch == null) { + throw new IllegalArgumentException("Parameter activityLogAlertPatch is required and cannot be null."); + } + Validator.validate(activityLogAlertPatch); + final String apiVersion = "2017-04-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, apiVersion, activityLogAlertPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-04-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2017-04-01"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogsInner.java new file mode 100644 index 000000000000..984f0c019d54 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ActivityLogsInner.java @@ -0,0 +1,395 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActivityLogs. + */ +public class ActivityLogsInner { + /** The Retrofit service to perform REST calls. */ + private ActivityLogsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActivityLogsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActivityLogsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActivityLogsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActivityLogs to be + * used by Retrofit to perform actually REST calls. + */ + interface ActivityLogsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogs list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$select") String select, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ActivityLogs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Provides the list of records from the activity logs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Provides the list of records from the activity logs. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Provides the list of records from the activity logs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + final String filter = null; + final String select = null; + return service.list(this.client.subscriptionId(), apiVersion, filter, select, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList list(final String filter, final String select) { + ServiceResponse> response = listSinglePageAsync(filter, select).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final String select, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, select), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listAsync(final String filter, final String select) { + return listWithServiceResponseAsync(filter, select) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final String select) { + return listSinglePageAsync(filter, select) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + ServiceResponse> * @param filter Reduces the set of data collected.<br>The **$filter** argument is very restricted and allows only the following patterns.<br>- *List events for a resource group*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq 'resourceGroupName'.<br>- *List events for resource*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq 'resourceURI'.<br>- *List events for a subscription in a time range*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'.<br>- *List events for a resource provider*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq 'resourceProviderName'.<br>- *List events for a correlation Id*: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq 'correlationID'.<br><br>**NOTE**: No other syntax is allowed. + ServiceResponse> * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final String select) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + return service.list(this.client.subscriptionId(), apiVersion, filter, select, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Provides the list of records from the activity logs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Provides the list of records from the activity logs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Provides the list of records from the activity logs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Provides the list of records from the activity logs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java new file mode 100644 index 000000000000..0582f08c7fe2 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleIncidentsInner.java @@ -0,0 +1,246 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AlertRuleIncidents. + */ +public class AlertRuleIncidentsInner { + /** The Retrofit service to perform REST calls. */ + private AlertRuleIncidentsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of AlertRuleIncidentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AlertRuleIncidentsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(AlertRuleIncidentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AlertRuleIncidents to be + * used by Retrofit to perform actually REST calls. + */ + interface AlertRuleIncidentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRuleIncidents get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("incidentName") String incidentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRuleIncidents listByAlertRule" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents") + Observable> listByAlertRule(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IncidentInner object if successful. + */ + public IncidentInner get(String resourceGroupName, String ruleName, String incidentName) { + return getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName).toBlocking().single().body(); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String ruleName, String incidentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName), serviceCallback); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IncidentInner object + */ + public Observable getAsync(String resourceGroupName, String ruleName, String incidentName) { + return getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName).map(new Func1, IncidentInner>() { + @Override + public IncidentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IncidentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String ruleName, String incidentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (incidentName == null) { + throw new IllegalArgumentException("Parameter incidentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.get(resourceGroupName, ruleName, incidentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<IncidentInner> object if successful. + */ + public List listByAlertRule(String resourceGroupName, String ruleName) { + return listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAlertRuleAsync(String resourceGroupName, String ruleName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IncidentInner> object + */ + public Observable> listByAlertRuleAsync(String resourceGroupName, String ruleName) { + return listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IncidentInner> object + */ + public Observable>> listByAlertRuleWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.listByAlertRule(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAlertRuleDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAlertRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleResourceInner.java new file mode 100644 index 000000000000..8996fe87ad7b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRuleResourceInner.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.RuleCondition; +import java.util.List; +import com.microsoft.azure.management.monitor.RuleAction; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The alert rule resource. + */ +@JsonFlatten +public class AlertRuleResourceInner extends Resource { + /** + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String alertRuleResourceName; + + /** + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /** + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition", required = true) + private RuleCondition condition; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the name of the alert rule. + * + * @return the alertRuleResourceName value + */ + public String alertRuleResourceName() { + return this.alertRuleResourceName; + } + + /** + * Set the name of the alert rule. + * + * @param alertRuleResourceName the alertRuleResourceName value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withAlertRuleResourceName(String alertRuleResourceName) { + this.alertRuleResourceName = alertRuleResourceName; + return this; + } + + /** + * Get the description of the alert rule that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition that results in the alert rule being activated. + * + * @return the condition value + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition that results in the alert rule being activated. + * + * @param condition the condition value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java new file mode 100644 index 000000000000..9296860dfb00 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AlertRulesInner.java @@ -0,0 +1,612 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.AlertRuleResourcePatch; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AlertRules. + */ +public class AlertRulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private AlertRulesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of AlertRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AlertRulesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(AlertRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AlertRules to be + * used by Retrofit to perform actually REST calls. + */ + interface AlertRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body AlertRuleResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body AlertRuleResourcePatch alertRulesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AlertRules list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2016-03-01"; + return service.createOrUpdate(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner update(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).toBlocking().single().body(); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource), serviceCallback); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (alertRulesResource == null) { + throw new IllegalArgumentException("Parameter alertRulesResource is required and cannot be null."); + } + Validator.validate(alertRulesResource); + final String apiVersion = "2016-03-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, alertRulesResource, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List the alert rules within a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the alert rules within a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the alert rules within a subscription. + * + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the alert rules within a subscription. + * + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingResourceInner.java new file mode 100644 index 000000000000..5d01605fcc3d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingResourceInner.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.AutoscaleProfile; +import com.microsoft.azure.management.monitor.AutoscaleNotification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The autoscale setting resource. + */ +@JsonFlatten +public class AutoscaleSettingResourceInner extends Resource { + /** + * the collection of automatic scaling profiles that specify different + * scaling parameters for different time periods. A maximum of 20 profiles + * can be specified. + */ + @JsonProperty(value = "properties.profiles", required = true) + private List profiles; + + /** + * the collection of notifications. + */ + @JsonProperty(value = "properties.notifications") + private List notifications; + + /** + * the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'true'. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * the name of the autoscale setting. + */ + @JsonProperty(value = "properties.name") + private String autoscaleSettingResourceName; + + /** + * the resource identifier of the resource that the autoscale setting + * should be added to. + */ + @JsonProperty(value = "properties.targetResourceUri") + private String targetResourceUri; + + /** + * Get the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value + */ + public List profiles() { + return this.profiles; + } + + /** + * Set the collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified. + * + * @param profiles the profiles value to set + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withProfiles(List profiles) { + this.profiles = profiles; + return this; + } + + /** + * Get the collection of notifications. + * + * @return the notifications value + */ + public List notifications() { + return this.notifications; + } + + /** + * Set the collection of notifications. + * + * @param notifications the notifications value to set + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withNotifications(List notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'true'. + * + * @param enabled the enabled value to set + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the name of the autoscale setting. + * + * @return the autoscaleSettingResourceName value + */ + public String autoscaleSettingResourceName() { + return this.autoscaleSettingResourceName; + } + + /** + * Set the name of the autoscale setting. + * + * @param autoscaleSettingResourceName the autoscaleSettingResourceName value to set + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withAutoscaleSettingResourceName(String autoscaleSettingResourceName) { + this.autoscaleSettingResourceName = autoscaleSettingResourceName; + return this; + } + + /** + * Get the resource identifier of the resource that the autoscale setting should be added to. + * + * @return the targetResourceUri value + */ + public String targetResourceUri() { + return this.targetResourceUri; + } + + /** + * Set the resource identifier of the resource that the autoscale setting should be added to. + * + * @param targetResourceUri the targetResourceUri value to set + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withTargetResourceUri(String targetResourceUri) { + this.targetResourceUri = targetResourceUri; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java new file mode 100644 index 000000000000..e9747e45cdd0 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/AutoscaleSettingsInner.java @@ -0,0 +1,896 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.monitor.AutoscaleSettingResourcePatch; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AutoscaleSettings. + */ +public class AutoscaleSettingsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private AutoscaleSettingsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of AutoscaleSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AutoscaleSettingsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(AutoscaleSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AutoscaleSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface AutoscaleSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Path("subscriptionId") String subscriptionId, @Body AutoscaleSettingResourceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("autoscaleSettingName") String autoscaleSettingName, @Query("api-version") String apiVersion, @Body AutoscaleSettingResourcePatch autoscaleSettingResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.AutoscaleSettings listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AutoscaleSettingResourceInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the autoscale settings for a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AutoscaleSettingResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoscaleSettingResourceInner object if successful. + */ + public AutoscaleSettingResourceInner createOrUpdate(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, parameters), serviceCallback); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, parameters).map(new Func1, AutoscaleSettingResourceInner>() { + @Override + public AutoscaleSettingResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (autoscaleSettingName == null) { + throw new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2015-04-01"; + return service.createOrUpdate(resourceGroupName, autoscaleSettingName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String autoscaleSettingName) { + deleteWithServiceResponseAsync(resourceGroupName, autoscaleSettingName).toBlocking().single().body(); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String autoscaleSettingName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, autoscaleSettingName), serviceCallback); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String autoscaleSettingName) { + return deleteWithServiceResponseAsync(resourceGroupName, autoscaleSettingName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (autoscaleSettingName == null) { + throw new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + return service.delete(resourceGroupName, autoscaleSettingName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoscaleSettingResourceInner object if successful. + */ + public AutoscaleSettingResourceInner getByResourceGroup(String resourceGroupName, String autoscaleSettingName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, autoscaleSettingName).toBlocking().single().body(); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String autoscaleSettingName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, autoscaleSettingName), serviceCallback); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String autoscaleSettingName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, autoscaleSettingName).map(new Func1, AutoscaleSettingResourceInner>() { + @Override + public AutoscaleSettingResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (autoscaleSettingName == null) { + throw new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + return service.getByResourceGroup(resourceGroupName, autoscaleSettingName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AutoscaleSettingResourceInner object if successful. + */ + public AutoscaleSettingResourceInner update(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + return updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).toBlocking().single().body(); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource), serviceCallback); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + return updateWithServiceResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).map(new Func1, AutoscaleSettingResourceInner>() { + @Override + public AutoscaleSettingResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AutoscaleSettingResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (autoscaleSettingName == null) { + throw new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null."); + } + if (autoscaleSettingResource == null) { + throw new IllegalArgumentException("Parameter autoscaleSettingResource is required and cannot be null."); + } + Validator.validate(autoscaleSettingResource); + final String apiVersion = "2015-04-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, autoscaleSettingName, apiVersion, autoscaleSettingResource, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AutoscaleSettingResourceInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AutoscaleSettingResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2015-04-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AutoscaleSettingResourceInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the autoscale settings for a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AutoscaleSettingResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AutoscaleSettingResourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AutoscaleSettingResourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the autoscale settings for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AutoscaleSettingResourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java new file mode 100644 index 000000000000..051669178c4c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/BaselineResponseInner.java @@ -0,0 +1,231 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import org.joda.time.Period; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.Baseline; +import com.microsoft.azure.management.monitor.BaselineMetadataValue; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The response to a baseline query. + */ +@JsonFlatten +public class BaselineResponseInner { + /** + * the metric baseline Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * the resource type of the baseline resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * the name and the display name of the metric, i.e. it is localizable + * string. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner name; + + /** + * The timespan for which the data was retrieved. Its value consists of two + * datetimes concatenated, separated by '/'. This may be adjusted in the + * future and returned back from what was originally requested. + */ + @JsonProperty(value = "properties.timespan") + private String timespan; + + /** + * The interval (window size) for which the metric data was returned in. + * This may be adjusted in the future and returned back from what was + * originally requested. This is not present if a metadata request was + * made. + */ + @JsonProperty(value = "properties.interval") + private Period interval; + + /** + * The aggregation type of the metric. + */ + @JsonProperty(value = "properties.aggregation") + private String aggregation; + + /** + * the array of timestamps of the baselines. + */ + @JsonProperty(value = "properties.timestamps") + private List timestamps; + + /** + * the baseline values for each sensitivity. + */ + @JsonProperty(value = "properties.baseline") + private List baseline; + + /** + * the baseline metadata values. + */ + @JsonProperty(value = "properties.metadata") + private List metadata; + + /** + * Get the metric baseline Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the resource type of the baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name and the display name of the metric, i.e. it is localizable string. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Get the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @param timespan the timespan value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @return the interval value + */ + public Period interval() { + return this.interval; + } + + /** + * Set the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @param interval the interval value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withInterval(Period interval) { + this.interval = interval; + return this; + } + + /** + * Get the aggregation type of the metric. + * + * @return the aggregation value + */ + public String aggregation() { + return this.aggregation; + } + + /** + * Set the aggregation type of the metric. + * + * @param aggregation the aggregation value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withAggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the baseline values for each sensitivity. + * + * @return the baseline value + */ + public List baseline() { + return this.baseline; + } + + /** + * Set the baseline values for each sensitivity. + * + * @param baseline the baseline value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withBaseline(List baseline) { + this.baseline = baseline; + return this; + } + + /** + * Get the baseline metadata values. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the baseline metadata values. + * + * @param metadata the metadata value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java new file mode 100644 index 000000000000..170a6725c336 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/CalculateBaselineResponseInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.Baseline; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a calculate baseline call. + */ +public class CalculateBaselineResponseInner { + /** + * the resource type of the baseline resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * the array of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps") + private List timestamps; + + /** + * the baseline values for each sensitivity. + */ + @JsonProperty(value = "baseline", required = true) + private List baseline; + + /** + * Get the resource type of the baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the baseline resource. + * + * @param type the type value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the baseline values for each sensitivity. + * + * @return the baseline value + */ + public List baseline() { + return this.baseline; + } + + /** + * Set the baseline values for each sensitivity. + * + * @param baseline the baseline value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withBaseline(List baseline) { + this.baseline = baseline; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceCollectionInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceCollectionInner.java new file mode 100644 index 000000000000..c5b72b005723 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceCollectionInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a collection of diagnostic setting category resources. + */ +public class DiagnosticSettingsCategoryResourceCollectionInner { + /** + * The collection of diagnostic settings category resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the collection of diagnostic settings category resources. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the collection of diagnostic settings category resources. + * + * @param value the value value to set + * @return the DiagnosticSettingsCategoryResourceCollectionInner object itself. + */ + public DiagnosticSettingsCategoryResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceInner.java new file mode 100644 index 000000000000..fa3f913f8b68 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategoryResourceInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.CategoryType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.monitor.ProxyOnlyResource; + +/** + * The diagnostic settings category resource. + */ +@JsonFlatten +public class DiagnosticSettingsCategoryResourceInner extends ProxyOnlyResource { + /** + * The type of the diagnostic settings category. Possible values include: + * 'Metrics', 'Logs'. + */ + @JsonProperty(value = "properties.categoryType") + private CategoryType categoryType; + + /** + * Get the type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs'. + * + * @return the categoryType value + */ + public CategoryType categoryType() { + return this.categoryType; + } + + /** + * Set the type of the diagnostic settings category. Possible values include: 'Metrics', 'Logs'. + * + * @param categoryType the categoryType value to set + * @return the DiagnosticSettingsCategoryResourceInner object itself. + */ + public DiagnosticSettingsCategoryResourceInner withCategoryType(CategoryType categoryType) { + this.categoryType = categoryType; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategorysInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategorysInner.java new file mode 100644 index 000000000000..932dadbe5389 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsCategorysInner.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DiagnosticSettingsCategorys. + */ +public class DiagnosticSettingsCategorysInner { + /** The Retrofit service to perform REST calls. */ + private DiagnosticSettingsCategorysService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of DiagnosticSettingsCategorysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DiagnosticSettingsCategorysInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(DiagnosticSettingsCategorysService.class); + this.client = client; + } + + /** + * The interface defining all the services for DiagnosticSettingsCategorys to be + * used by Retrofit to perform actually REST calls. + */ + interface DiagnosticSettingsCategorysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettingsCategorys get" }) + @GET("{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}") + Observable> get(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettingsCategorys list" }) + @GET("{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticSettingsCategoryResourceInner object if successful. + */ + public DiagnosticSettingsCategoryResourceInner get(String resourceUri, String name) { + return getWithServiceResponseAsync(resourceUri, name).toBlocking().single().body(); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, name), serviceCallback); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsCategoryResourceInner object + */ + public Observable getAsync(String resourceUri, String name) { + return getWithServiceResponseAsync(resourceUri, name).map(new Func1, DiagnosticSettingsCategoryResourceInner>() { + @Override + public DiagnosticSettingsCategoryResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsCategoryResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2017-05-01-preview"; + return service.get(resourceUri, name, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticSettingsCategoryResourceCollectionInner object if successful. + */ + public DiagnosticSettingsCategoryResourceCollectionInner list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsCategoryResourceCollectionInner object + */ + public Observable listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1, DiagnosticSettingsCategoryResourceCollectionInner>() { + @Override + public DiagnosticSettingsCategoryResourceCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsCategoryResourceCollectionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-05-01-preview"; + return service.list(resourceUri, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsInner.java new file mode 100644 index 000000000000..b0ae08efd397 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsInner.java @@ -0,0 +1,402 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DiagnosticSettings. + */ +public class DiagnosticSettingsInner implements InnerSupportsDelete { + /** The Retrofit service to perform REST calls. */ + private DiagnosticSettingsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of DiagnosticSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DiagnosticSettingsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(DiagnosticSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DiagnosticSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface DiagnosticSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettings get" }) + @GET("{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}") + Observable> get(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettings createOrUpdate" }) + @PUT("{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}") + Observable> createOrUpdate(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("name") String name, @Query("api-version") String apiVersion, @Body DiagnosticSettingsResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettings delete" }) + @HTTP(path = "{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.DiagnosticSettings list" }) + @GET("{resourceUri}/providers/microsoft.insights/diagnosticSettings") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticSettingsResourceInner object if successful. + */ + public DiagnosticSettingsResourceInner get(String resourceUri, String name) { + return getWithServiceResponseAsync(resourceUri, name).toBlocking().single().body(); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, name), serviceCallback); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceInner object + */ + public Observable getAsync(String resourceUri, String name) { + return getWithServiceResponseAsync(resourceUri, name).map(new Func1, DiagnosticSettingsResourceInner>() { + @Override + public DiagnosticSettingsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2017-05-01-preview"; + return service.get(resourceUri, name, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticSettingsResourceInner object if successful. + */ + public DiagnosticSettingsResourceInner createOrUpdate(String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceUri, name, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceUri, String name, DiagnosticSettingsResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceUri, name, parameters), serviceCallback); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceInner object + */ + public Observable createOrUpdateAsync(String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceUri, name, parameters).map(new Func1, DiagnosticSettingsResourceInner>() { + @Override + public DiagnosticSettingsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-05-01-preview"; + return service.createOrUpdate(resourceUri, name, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceUri, String name) { + deleteWithServiceResponseAsync(resourceUri, name).toBlocking().single().body(); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceUri, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceUri, name), serviceCallback); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceUri, String name) { + return deleteWithServiceResponseAsync(resourceUri, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceUri, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + final String apiVersion = "2017-05-01-preview"; + return service.delete(resourceUri, name, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DiagnosticSettingsResourceCollectionInner object if successful. + */ + public DiagnosticSettingsResourceCollectionInner list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceCollectionInner object + */ + public Observable listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1, DiagnosticSettingsResourceCollectionInner>() { + @Override + public DiagnosticSettingsResourceCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiagnosticSettingsResourceCollectionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-05-01-preview"; + return service.list(resourceUri, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceCollectionInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceCollectionInner.java new file mode 100644 index 000000000000..253bba0df914 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceCollectionInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a collection of alert rule resources. + */ +public class DiagnosticSettingsResourceCollectionInner { + /** + * The collection of diagnostic settings resources;. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the collection of diagnostic settings resources;. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the collection of diagnostic settings resources;. + * + * @param value the value value to set + * @return the DiagnosticSettingsResourceCollectionInner object itself. + */ + public DiagnosticSettingsResourceCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceInner.java new file mode 100644 index 000000000000..cd2aac1fd364 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/DiagnosticSettingsResourceInner.java @@ -0,0 +1,211 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.MetricSettings; +import com.microsoft.azure.management.monitor.LogSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.monitor.ProxyOnlyResource; + +/** + * The diagnostic setting resource. + */ +@JsonFlatten +public class DiagnosticSettingsResourceInner extends ProxyOnlyResource { + /** + * The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule Id of the diagnostic setting. This is here to + * maintain backwards compatibility. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * The resource Id for the event hub authorization rule. + */ + @JsonProperty(value = "properties.eventHubAuthorizationRuleId") + private String eventHubAuthorizationRuleId; + + /** + * The name of the event hub. If none is specified, the default event hub + * will be selected. + */ + @JsonProperty(value = "properties.eventHubName") + private String eventHubName; + + /** + * the list of metric settings. + */ + @JsonProperty(value = "properties.metrics") + private List metrics; + + /** + * the list of logs settings. + */ + @JsonProperty(value = "properties.logs") + private List logs; + + /** + * The workspace ID (resource ID of a Log Analytics workspace) for a Log + * Analytics workspace to which you would like to send Diagnostic Logs. + * Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + */ + @JsonProperty(value = "properties.workspaceId") + private String workspaceId; + + /** + * Get the resource ID of the storage account to which you would like to send Diagnostic Logs. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource ID of the storage account to which you would like to send Diagnostic Logs. + * + * @param storageAccountId the storageAccountId value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get the resource Id for the event hub authorization rule. + * + * @return the eventHubAuthorizationRuleId value + */ + public String eventHubAuthorizationRuleId() { + return this.eventHubAuthorizationRuleId; + } + + /** + * Set the resource Id for the event hub authorization rule. + * + * @param eventHubAuthorizationRuleId the eventHubAuthorizationRuleId value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId) { + this.eventHubAuthorizationRuleId = eventHubAuthorizationRuleId; + return this; + } + + /** + * Get the name of the event hub. If none is specified, the default event hub will be selected. + * + * @return the eventHubName value + */ + public String eventHubName() { + return this.eventHubName; + } + + /** + * Set the name of the event hub. If none is specified, the default event hub will be selected. + * + * @param eventHubName the eventHubName value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withEventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Get the list of metric settings. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + + /** + * Set the list of metric settings. + * + * @param metrics the metrics value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + /** + * Get the list of logs settings. + * + * @return the logs value + */ + public List logs() { + return this.logs; + } + + /** + * Set the list of logs settings. + * + * @param logs the logs value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withLogs(List logs) { + this.logs = logs; + return this; + } + + /** + * Get the workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + * + * @param workspaceId the workspaceId value to set + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java new file mode 100644 index 000000000000..baa063f27381 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventCategoriesInner.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EventCategories. + */ +public class EventCategoriesInner { + /** The Retrofit service to perform REST calls. */ + private EventCategoriesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of EventCategoriesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EventCategoriesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(EventCategoriesService.class); + this.client = client; + } + + /** + * The interface defining all the services for EventCategories to be + * used by Retrofit to perform actually REST calls. + */ + interface EventCategoriesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.EventCategories list" }) + @GET("providers/microsoft.insights/eventcategories") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<LocalizableStringInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocalizableStringInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LocalizableStringInner> object + */ + public Observable>> listWithServiceResponseAsync() { + final String apiVersion = "2015-04-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventDataInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventDataInner.java new file mode 100644 index 000000000000..c266098f48a2 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/EventDataInner.java @@ -0,0 +1,405 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.SenderAuthorization; +import java.util.Map; +import com.microsoft.azure.management.monitor.HttpRequestInfo; +import com.microsoft.azure.management.monitor.EventLevel; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure event log entries are of type EventData. + */ +public class EventDataInner { + /** + * The sender authorization information. + */ + @JsonProperty(value = "authorization", access = JsonProperty.Access.WRITE_ONLY) + private SenderAuthorization authorization; + + /** + * key value pairs to identify ARM permissions. + */ + @JsonProperty(value = "claims", access = JsonProperty.Access.WRITE_ONLY) + private Map claims; + + /** + * the email address of the user who has performed the operation, the UPN + * claim or SPN claim based on availability. + */ + @JsonProperty(value = "caller", access = JsonProperty.Access.WRITE_ONLY) + private String caller; + + /** + * the description of the event. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * the Id of this event as required by ARM for RBAC. It contains the + * EventDataID and a timestamp information. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * the event data Id. This is a unique identifier for an event. + */ + @JsonProperty(value = "eventDataId", access = JsonProperty.Access.WRITE_ONLY) + private String eventDataId; + + /** + * the correlation Id, usually a GUID in the string format. The correlation + * Id is shared among the events that belong to the same uber operation. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /** + * the event name. This value should not be confused with OperationName. + * For practical purposes, OperationName might be more appealing to end + * users. + */ + @JsonProperty(value = "eventName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner eventName; + + /** + * the event category. + */ + @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner category; + + /** + * the HTTP request info. Usually includes the 'clientRequestId', + * 'clientIpAddress' (IP address of the user who initiated the event) and + * 'method' (HTTP method e.g. PUT). + */ + @JsonProperty(value = "httpRequest", access = JsonProperty.Access.WRITE_ONLY) + private HttpRequestInfo httpRequest; + + /** + * the event level. Possible values include: 'Critical', 'Error', + * 'Warning', 'Informational', 'Verbose'. + */ + @JsonProperty(value = "level", access = JsonProperty.Access.WRITE_ONLY) + private EventLevel level; + + /** + * the resource group name of the impacted resource. + */ + @JsonProperty(value = "resourceGroupName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroupName; + + /** + * the resource provider name of the impacted resource. + */ + @JsonProperty(value = "resourceProviderName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner resourceProviderName; + + /** + * the resource uri that uniquely identifies the resource that caused this + * event. + */ + @JsonProperty(value = "resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /** + * the resource type. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner resourceType; + + /** + * It is usually a GUID shared among the events corresponding to single + * operation. This value should not be confused with EventName. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /** + * the operation name. + */ + @JsonProperty(value = "operationName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner operationName; + + /** + * the set of <Key, Value> pairs (usually a Dictionary<String, + * String>) that includes details about the event. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * a string describing the status of the operation. Some typical values + * are: Started, In progress, Succeeded, Failed, Resolved. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner status; + + /** + * the event sub status. Most of the time, when included, this captures the + * HTTP status code of the REST call. Common values are: OK (HTTP Status + * Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: + * 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: + * 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: + * 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable + * (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504). + */ + @JsonProperty(value = "subStatus", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner subStatus; + + /** + * the timestamp of when the event was generated by the Azure service + * processing the request corresponding the event. It in ISO 8601 format. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime eventTimestamp; + + /** + * the timestamp of when the event became available for querying via this + * API. It is in ISO 8601 format. This value should not be confused + * eventTimestamp. As there might be a delay between the occurrence time of + * the event, and the time that the event is submitted to the Azure logging + * infrastructure. + */ + @JsonProperty(value = "submissionTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime submissionTimestamp; + + /** + * the Azure subscription Id usually a GUID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * the Azure tenant Id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the sender authorization information. + * + * @return the authorization value + */ + public SenderAuthorization authorization() { + return this.authorization; + } + + /** + * Get key value pairs to identify ARM permissions. + * + * @return the claims value + */ + public Map claims() { + return this.claims; + } + + /** + * Get the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + * + * @return the caller value + */ + public String caller() { + return this.caller; + } + + /** + * Get the description of the event. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the event data Id. This is a unique identifier for an event. + * + * @return the eventDataId value + */ + public String eventDataId() { + return this.eventDataId; + } + + /** + * Get the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that belong to the same uber operation. + * + * @return the correlationId value + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the event name. This value should not be confused with OperationName. For practical purposes, OperationName might be more appealing to end users. + * + * @return the eventName value + */ + public LocalizableStringInner eventName() { + return this.eventName; + } + + /** + * Get the event category. + * + * @return the category value + */ + public LocalizableStringInner category() { + return this.category; + } + + /** + * Get the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who initiated the event) and 'method' (HTTP method e.g. PUT). + * + * @return the httpRequest value + */ + public HttpRequestInfo httpRequest() { + return this.httpRequest; + } + + /** + * Get the event level. Possible values include: 'Critical', 'Error', 'Warning', 'Informational', 'Verbose'. + * + * @return the level value + */ + public EventLevel level() { + return this.level; + } + + /** + * Get the resource group name of the impacted resource. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Get the resource provider name of the impacted resource. + * + * @return the resourceProviderName value + */ + public LocalizableStringInner resourceProviderName() { + return this.resourceProviderName; + } + + /** + * Get the resource uri that uniquely identifies the resource that caused this event. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Get the resource type. + * + * @return the resourceType value + */ + public LocalizableStringInner resourceType() { + return this.resourceType; + } + + /** + * Get it is usually a GUID shared among the events corresponding to single operation. This value should not be confused with EventName. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the operation name. + * + * @return the operationName value + */ + public LocalizableStringInner operationName() { + return this.operationName; + } + + /** + * Get the set of <Key, Value> pairs (usually a Dictionary<String, String>) that includes details about the event. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Get a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, Resolved. + * + * @return the status value + */ + public LocalizableStringInner status() { + return this.status; + } + + /** + * Get the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504). + * + * @return the subStatus value + */ + public LocalizableStringInner subStatus() { + return this.subStatus; + } + + /** + * Get the timestamp of when the event was generated by the Azure service processing the request corresponding the event. It in ISO 8601 format. + * + * @return the eventTimestamp value + */ + public DateTime eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value should not be confused eventTimestamp. As there might be a delay between the occurrence time of the event, and the time that the event is submitted to the Azure logging infrastructure. + * + * @return the submissionTimestamp value + */ + public DateTime submissionTimestamp() { + return this.submissionTimestamp; + } + + /** + * Get the Azure subscription Id usually a GUID. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the Azure tenant Id. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/IncidentInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/IncidentInner.java new file mode 100644 index 000000000000..87f25403db20 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/IncidentInner.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert incident indicates the activation status of an alert rule. + */ +public class IncidentInner { + /** + * Incident name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Rule name that is associated with the incident. + */ + @JsonProperty(value = "ruleName", access = JsonProperty.Access.WRITE_ONLY) + private String ruleName; + + /** + * A boolean to indicate whether the incident is active or resolved. + */ + @JsonProperty(value = "isActive", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActive; + + /** + * The time at which the incident was activated in ISO8601 format. + */ + @JsonProperty(value = "activatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime activatedTime; + + /** + * The time at which the incident was resolved in ISO8601 format. If null, + * it means the incident is still active. + */ + @JsonProperty(value = "resolvedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime resolvedTime; + + /** + * Get incident name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get rule name that is associated with the incident. + * + * @return the ruleName value + */ + public String ruleName() { + return this.ruleName; + } + + /** + * Get a boolean to indicate whether the incident is active or resolved. + * + * @return the isActive value + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Get the time at which the incident was activated in ISO8601 format. + * + * @return the activatedTime value + */ + public DateTime activatedTime() { + return this.activatedTime; + } + + /** + * Get the time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + * + * @return the resolvedTime value + */ + public DateTime resolvedTime() { + return this.resolvedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LocalizableStringInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LocalizableStringInner.java new file mode 100644 index 000000000000..e49943219a3f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LocalizableStringInner.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The localizable string class. + */ +public class LocalizableStringInner { + /** + * the invariant value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * the locale specific value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the invariant value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the invariant value. + * + * @param value the value value to set + * @return the LocalizableStringInner object itself. + */ + public LocalizableStringInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the locale specific value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the locale specific value. + * + * @param localizedValue the localizedValue value to set + * @return the LocalizableStringInner object itself. + */ + public LocalizableStringInner withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfileResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfileResourceInner.java new file mode 100644 index 000000000000..4ad11fc6e6f4 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfileResourceInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.RetentionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The log profile resource. + */ +@JsonFlatten +public class LogProfileResourceInner extends Resource { + /** + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming the Activity Log. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * List of regions for which Activity Log events should be stored or + * streamed. It is a comma separated list of valid ARM locations including + * the 'global' location. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or + * 'Action.'. + */ + @JsonProperty(value = "properties.categories", required = true) + private List categories; + + /** + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** + * Get the resource id of the storage account to which you would like to send the Activity Log. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource id of the storage account to which you would like to send the Activity Log. + * + * @param storageAccountId the storageAccountId value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @param locations the locations value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retention policy for the events in the log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java new file mode 100644 index 000000000000..5084cbf238a9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogProfilesInner.java @@ -0,0 +1,488 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.LogProfileResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LogProfiles. + */ +public class LogProfilesInner { + /** The Retrofit service to perform REST calls. */ + private LogProfilesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of LogProfilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LogProfilesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(LogProfilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LogProfiles to be + * used by Retrofit to perform actually REST calls. + */ + interface LogProfilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles get" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> get(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> createOrUpdate(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body LogProfileResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles update" }) + @PATCH("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("logProfileName") String logProfileName, @Query("api-version") String apiVersion, @Body LogProfileResourcePatch logProfilesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.LogProfiles list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String logProfileName) { + deleteWithServiceResponseAsync(logProfileName).toBlocking().single().body(); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String logProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(logProfileName), serviceCallback); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String logProfileName) { + return deleteWithServiceResponseAsync(logProfileName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String logProfileName) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.delete(logProfileName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner get(String logProfileName) { + return getWithServiceResponseAsync(logProfileName).toBlocking().single().body(); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String logProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(logProfileName), serviceCallback); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable getAsync(String logProfileName) { + return getWithServiceResponseAsync(logProfileName).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> getWithServiceResponseAsync(String logProfileName) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.get(logProfileName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner createOrUpdate(String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(logProfileName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String logProfileName, LogProfileResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(logProfileName, parameters), serviceCallback); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable createOrUpdateAsync(String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(logProfileName, parameters).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String logProfileName, LogProfileResourceInner parameters) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2016-03-01"; + return service.createOrUpdate(logProfileName, this.client.subscriptionId(), apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner update(String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithServiceResponseAsync(logProfileName, logProfilesResource).toBlocking().single().body(); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(logProfileName, logProfilesResource), serviceCallback); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithServiceResponseAsync(logProfileName, logProfilesResource).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (logProfilesResource == null) { + throw new IllegalArgumentException("Parameter logProfilesResource is required and cannot be null."); + } + Validator.validate(logProfilesResource); + final String apiVersion = "2016-03-01"; + return service.update(this.client.subscriptionId(), logProfileName, apiVersion, logProfilesResource, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the log profiles. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the log profiles. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the log profiles. + * + * @return the observable to the List<LogProfileResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the log profiles. + * + * @return the observable to the List<LogProfileResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java new file mode 100644 index 000000000000..35dfefbfa6b8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java @@ -0,0 +1,189 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Enabled; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.ProvisioningState; +import com.microsoft.azure.management.monitor.Source; +import com.microsoft.azure.management.monitor.Schedule; +import com.microsoft.azure.management.monitor.Action; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The Log Search Rule resource. + */ +@JsonFlatten +public class LogSearchRuleResourceInner extends Resource { + /** + * The description of the Log Search rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Provisioning state of the scheduled query rule. Possible values include: + * 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Data Source against which rule will Query Data. + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /** + * Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction. + */ + @JsonProperty(value = "properties.schedule") + private Schedule schedule; + + /** + * Action needs to be taken on rule execution. + */ + @JsonProperty(value = "properties.action", required = true) + private Action action; + + /** + * Get the description of the Log Search rule. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the Log Search rule. + * + * @param description the description value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get last time the rule was updated in IS08601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get data Source against which rule will Query Data. + * + * @return the source value + */ + public Source source() { + return this.source; + } + + /** + * Set data Source against which rule will Query Data. + * + * @param source the source value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSource(Source source) { + this.source = source; + return this; + } + + /** + * Get schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @param schedule the schedule value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get action needs to be taken on rule execution. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set action needs to be taken on rule execution. + * + * @param action the action value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAction(Action action) { + this.action = action; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java new file mode 100644 index 000000000000..0d158e316c36 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertResourceInner.java @@ -0,0 +1,333 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import org.joda.time.Period; +import com.microsoft.azure.management.monitor.MetricAlertCriteria; +import com.microsoft.azure.management.monitor.MetricAlertAction; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The metric alert resource. + */ +@JsonFlatten +public class MetricAlertResourceInner extends Resource { + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceType") + private String targetResourceType; + + /** + * the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceRegion") + private String targetResourceRegion; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the description of the metric alert that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get defines the specific alert criteria information. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set defines the specific alert criteria information. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the flag that indicates whether the alert should be auto resolved or not. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the flag that indicates whether the alert should be auto resolved or not. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java new file mode 100644 index 000000000000..e4e12b369a9b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertStatusCollectionInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.MetricAlertStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a collection of alert rule resources. + */ +public class MetricAlertStatusCollectionInner { + /** + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the values for the alert rule resources. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the values for the alert rule resources. + * + * @param value the value value to set + * @return the MetricAlertStatusCollectionInner object itself. + */ + public MetricAlertStatusCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java new file mode 100644 index 000000000000..248a1dfbaebd --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsInner.java @@ -0,0 +1,610 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.MetricAlertResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlerts. + */ +public class MetricAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatch parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner createOrUpdate(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-03-01"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-03-01"; + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.delete(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java new file mode 100644 index 000000000000..b7c32623336b --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricAlertsStatusInner.java @@ -0,0 +1,239 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlertsStatus. + */ +public class MetricAlertsStatusInner { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsStatusService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsStatusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsStatusInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsStatusService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlertsStatus to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsStatusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricAlertsStatus listByName" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}") + Observable> listByName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("statusName") String statusName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner list(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listAsync(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.list(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner listByName(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByNameAsync(String resourceGroupName, String ruleName, String statusName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listByNameAsync(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listByNameWithServiceResponseAsync(String resourceGroupName, String ruleName, String statusName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (statusName == null) { + throw new IllegalArgumentException("Parameter statusName is required and cannot be null."); + } + final String apiVersion = "2018-03-01"; + return service.listByName(this.client.subscriptionId(), resourceGroupName, ruleName, statusName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java new file mode 100644 index 000000000000..b2855c0b9fd4 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricBaselinesInner.java @@ -0,0 +1,332 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.ResultType; +import com.microsoft.azure.management.monitor.TimeSeriesInformation; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import org.joda.time.Period; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricBaselines. + */ +public class MetricBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private MetricBaselinesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricBaselinesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricBaselines get" }) + @GET("{resourceUri}/providers/microsoft.insights/baseline/{metricName}") + Observable> get(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("metricName") String metricName, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("aggregation") String aggregation, @Query("sensitivities") String sensitivities, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricBaselines calculateBaseline" }) + @POST("{resourceUri}/providers/microsoft.insights/calculatebaseline") + Observable> calculateBaseline(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Body TimeSeriesInformation timeSeriesInformation, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri, String metricName) { + return getWithServiceResponseAsync(resourceUri, metricName).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String metricName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, metricName), serviceCallback); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri, String metricName) { + return getWithServiceResponseAsync(resourceUri, metricName).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String metricName) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (metricName == null) { + throw new IllegalArgumentException("Parameter metricName is required and cannot be null."); + } + final String apiVersion = "2017-11-01-preview"; + final String timespan = null; + final Period interval = null; + final String aggregation = null; + final String sensitivities = null; + final ResultType resultType = null; + return service.get(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType) { + return getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType), serviceCallback); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType) { + return getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (metricName == null) { + throw new IllegalArgumentException("Parameter metricName is required and cannot be null."); + } + final String apiVersion = "2017-11-01-preview"; + return service.get(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CalculateBaselineResponseInner object if successful. + */ + public CalculateBaselineResponseInner calculateBaseline(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + return calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation).toBlocking().single().body(); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation), serviceCallback); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CalculateBaselineResponseInner object + */ + public Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + return calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation).map(new Func1, CalculateBaselineResponseInner>() { + @Override + public CalculateBaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CalculateBaselineResponseInner object + */ + public Observable> calculateBaselineWithServiceResponseAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (timeSeriesInformation == null) { + throw new IllegalArgumentException("Parameter timeSeriesInformation is required and cannot be null."); + } + Validator.validate(timeSeriesInformation); + final String apiVersion = "2017-11-01-preview"; + return service.calculateBaseline(resourceUri, apiVersion, timeSeriesInformation, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = calculateBaselineDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse calculateBaselineDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionInner.java new file mode 100644 index 000000000000..d5ac3045448f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionInner.java @@ -0,0 +1,288 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Unit; +import com.microsoft.azure.management.monitor.AggregationType; +import java.util.List; +import com.microsoft.azure.management.monitor.MetricAvailability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric definition class specifies the metadata for a metric. + */ +public class MetricDefinitionInner { + /** + * Flag to indicate whether the dimension is required. + */ + @JsonProperty(value = "isDimensionRequired") + private Boolean isDimensionRequired; + + /** + * the resource identifier of the resource that emitted the metric. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * the namespace the metric belongs to. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /** + * the name and the display name of the metric, i.e. it is a localizable + * string. + */ + @JsonProperty(value = "name") + private LocalizableStringInner name; + + /** + * the unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + */ + @JsonProperty(value = "unit") + private Unit unit; + + /** + * the primary aggregation type value defining how to use the values for + * display. Possible values include: 'None', 'Average', 'Count', 'Minimum', + * 'Maximum', 'Total'. + */ + @JsonProperty(value = "primaryAggregationType") + private AggregationType primaryAggregationType; + + /** + * the collection of what aggregation types are supported. + */ + @JsonProperty(value = "supportedAggregationTypes") + private List supportedAggregationTypes; + + /** + * the collection of what aggregation intervals are available to be + * queried. + */ + @JsonProperty(value = "metricAvailabilities") + private List metricAvailabilities; + + /** + * the resource identifier of the metric definition. + */ + @JsonProperty(value = "id") + private String id; + + /** + * the name and the display name of the dimension, i.e. it is a localizable + * string. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get flag to indicate whether the dimension is required. + * + * @return the isDimensionRequired value + */ + public Boolean isDimensionRequired() { + return this.isDimensionRequired; + } + + /** + * Set flag to indicate whether the dimension is required. + * + * @param isDimensionRequired the isDimensionRequired value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withIsDimensionRequired(Boolean isDimensionRequired) { + this.isDimensionRequired = isDimensionRequired; + return this; + } + + /** + * Get the resource identifier of the resource that emitted the metric. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource identifier of the resource that emitted the metric. + * + * @param resourceId the resourceId value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the namespace the metric belongs to. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace the metric belongs to. + * + * @param namespace the namespace value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the name and the display name of the metric, i.e. it is a localizable string. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name and the display name of the metric, i.e. it is a localizable string. + * + * @param name the name value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + * + * @return the unit value + */ + public Unit unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + * + * @param unit the unit value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withUnit(Unit unit) { + this.unit = unit; + return this; + } + + /** + * Get the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @return the primaryAggregationType value + */ + public AggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Set the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @param primaryAggregationType the primaryAggregationType value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withPrimaryAggregationType(AggregationType primaryAggregationType) { + this.primaryAggregationType = primaryAggregationType; + return this; + } + + /** + * Get the collection of what aggregation types are supported. + * + * @return the supportedAggregationTypes value + */ + public List supportedAggregationTypes() { + return this.supportedAggregationTypes; + } + + /** + * Set the collection of what aggregation types are supported. + * + * @param supportedAggregationTypes the supportedAggregationTypes value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withSupportedAggregationTypes(List supportedAggregationTypes) { + this.supportedAggregationTypes = supportedAggregationTypes; + return this; + } + + /** + * Get the collection of what aggregation intervals are available to be queried. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Set the collection of what aggregation intervals are available to be queried. + * + * @param metricAvailabilities the metricAvailabilities value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withMetricAvailabilities(List metricAvailabilities) { + this.metricAvailabilities = metricAvailabilities; + return this; + } + + /** + * Get the resource identifier of the metric definition. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the resource identifier of the metric definition. + * + * @param id the id value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name and the display name of the dimension, i.e. it is a localizable string. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the name and the display name of the dimension, i.e. it is a localizable string. + * + * @param dimensions the dimensions value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java new file mode 100644 index 000000000000..5d4cb841b257 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricDefinitionsInner.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricDefinitions. + */ +public class MetricDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private MetricDefinitionsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricDefinitionsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricDefinitions list" }) + @GET("{resourceUri}/providers/microsoft.insights/metricDefinitions") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricDefinitionInner> object if successful. + */ + public List list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2018-01-01"; + final String metricnamespace = null; + return service.list(resourceUri, apiVersion, metricnamespace, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricDefinitionInner> object if successful. + */ + public List list(String resourceUri, String metricnamespace) { + return listWithServiceResponseAsync(resourceUri, metricnamespace).toBlocking().single().body(); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, String metricnamespace, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, metricnamespace), serviceCallback); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listAsync(String resourceUri, String metricnamespace) { + return listWithServiceResponseAsync(resourceUri, metricnamespace).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri, String metricnamespace) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2018-01-01"; + return service.list(resourceUri, apiVersion, metricnamespace, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java new file mode 100644 index 000000000000..d2c0995c2e4a --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricInner.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Unit; +import java.util.List; +import com.microsoft.azure.management.monitor.TimeSeriesElement; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The result data of a query. + */ +public class MetricInner { + /** + * the metric Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * the resource type of the metric resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * the name and the display name of the metric, i.e. it is localizable + * string. + */ + @JsonProperty(value = "name", required = true) + private LocalizableStringInner name; + + /** + * the unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + */ + @JsonProperty(value = "unit", required = true) + private Unit unit; + + /** + * the time series returned when a data query is performed. + */ + @JsonProperty(value = "timeseries", required = true) + private List timeseries; + + /** + * Get the metric Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the metric Id. + * + * @param id the id value to set + * @return the MetricInner object itself. + */ + public MetricInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the resource type of the metric resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the metric resource. + * + * @param type the type value to set + * @return the MetricInner object itself. + */ + public MetricInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name and the display name of the metric, i.e. it is localizable string. + * + * @return the name value + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name and the display name of the metric, i.e. it is localizable string. + * + * @param name the name value to set + * @return the MetricInner object itself. + */ + public MetricInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + * + * @return the unit value + */ + public Unit unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified'. + * + * @param unit the unit value to set + * @return the MetricInner object itself. + */ + public MetricInner withUnit(Unit unit) { + this.unit = unit; + return this; + } + + /** + * Get the time series returned when a data query is performed. + * + * @return the timeseries value + */ + public List timeseries() { + return this.timeseries; + } + + /** + * Set the time series returned when a data query is performed. + * + * @param timeseries the timeseries value to set + * @return the MetricInner object itself. + */ + public MetricInner withTimeseries(List timeseries) { + this.timeseries = timeseries; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java new file mode 100644 index 000000000000..16befcbab181 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespaceInner.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.MetricNamespaceName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric namespace class specifies the metadata for a metric namespace. + */ +public class MetricNamespaceInner { + /** + * The ID of the metricNamespace. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The type of the namespace. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The name of the namespace. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Properties which include the fully qualified namespace name. + */ + @JsonProperty(value = "properties") + private MetricNamespaceName properties; + + /** + * Get the ID of the metricNamespace. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the ID of the metricNamespace. + * + * @param id the id value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type of the namespace. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the namespace. + * + * @param type the type value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name of the namespace. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the namespace. + * + * @param name the name value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get properties which include the fully qualified namespace name. + * + * @return the properties value + */ + public MetricNamespaceName properties() { + return this.properties; + } + + /** + * Set properties which include the fully qualified namespace name. + * + * @param properties the properties value to set + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withProperties(MetricNamespaceName properties) { + this.properties = properties; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java new file mode 100644 index 000000000000..1dda443239f3 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricNamespacesInner.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricNamespaces. + */ +public class MetricNamespacesInner { + /** The Retrofit service to perform REST calls. */ + private MetricNamespacesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricNamespacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricNamespacesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricNamespacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricNamespaces to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricNamespacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MetricNamespaces list" }) + @GET("{resourceUri}/providers/microsoft.insights/metricNamespaces") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Query("startTime") String startTime, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricNamespaceInner> object if successful. + */ + public List list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable> listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-12-01-preview"; + final String startTime = null; + return service.list(resourceUri, apiVersion, startTime, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricNamespaceInner> object if successful. + */ + public List list(String resourceUri, String startTime) { + return listWithServiceResponseAsync(resourceUri, startTime).toBlocking().single().body(); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, String startTime, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, startTime), serviceCallback); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable> listAsync(String resourceUri, String startTime) { + return listWithServiceResponseAsync(resourceUri, startTime).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricNamespaceInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri, String startTime) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2017-12-01-preview"; + return service.list(resourceUri, apiVersion, startTime, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java new file mode 100644 index 000000000000..4351df4782b4 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MetricsInner.java @@ -0,0 +1,264 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.ResultType; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import org.joda.time.Period; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Metrics. + */ +public class MetricsInner { + /** The Retrofit service to perform REST calls. */ + private MetricsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Metrics to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.Metrics list" }) + @GET("{resourceUri}/providers/microsoft.insights/metrics") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("metricnames") String metricnames, @Query("aggregation") String aggregation, @Query("top") Integer top, @Query("orderby") String orderby, @Query("$filter") String filter, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResponseInner object if successful. + */ + public ResponseInner list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResponseInner object + */ + public Observable listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1, ResponseInner>() { + @Override + public ResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResponseInner object + */ + public Observable> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2018-01-01"; + final String timespan = null; + final Period interval = null; + final String metricnames = null; + final String aggregation = null; + final Integer top = null; + final String orderby = null; + final String filter = null; + final ResultType resultType = null; + final String metricnamespace = null; + return service.list(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, apiVersion, metricnamespace, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + * @param orderby The aggregation to use for sorting results and the direction of the sort. + Only one order can be specified. + Examples: sum asc. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResponseInner object if successful. + */ + public ResponseInner list(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { + return listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace).toBlocking().single().body(); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + * @param orderby The aggregation to use for sorting results and the direction of the sort. + Only one order can be specified. + Examples: sum asc. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace), serviceCallback); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + * @param orderby The aggregation to use for sorting results and the direction of the sort. + Only one order can be specified. + Examples: sum asc. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResponseInner object + */ + public Observable listAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { + return listWithServiceResponseAsync(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, metricnamespace).map(new Func1, ResponseInner>() { + @Override + public ResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. + Valid only if $filter is specified. + Defaults to 10. + * @param orderby The aggregation to use for sorting results and the direction of the sort. + Only one order can be specified. + Examples: sum asc. + * @param filter The **$filter** is used to reduce the set of metric data returned.<br>Example:<br>Metric contains metadata A, B and C.<br>- Return all time series of C where A = a1 and B = b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the logical or operator cannot separate two different metadata names.<br>- Return all time series where A = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResponseInner object + */ + public Observable> listWithServiceResponseAsync(String resourceUri, String timespan, Period interval, String metricnames, String aggregation, Integer top, String orderby, String filter, ResultType resultType, String metricnamespace) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2018-01-01"; + return service.list(resourceUri, timespan, interval, metricnames, aggregation, top, orderby, filter, resultType, apiVersion, metricnamespace, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java new file mode 100644 index 000000000000..3cc6bc951d86 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,449 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The AutoscaleSettingsInner object to access its operations. + */ + private AutoscaleSettingsInner autoscaleSettings; + + /** + * Gets the AutoscaleSettingsInner object to access its operations. + * @return the AutoscaleSettingsInner object. + */ + public AutoscaleSettingsInner autoscaleSettings() { + return this.autoscaleSettings; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The AlertRuleIncidentsInner object to access its operations. + */ + private AlertRuleIncidentsInner alertRuleIncidents; + + /** + * Gets the AlertRuleIncidentsInner object to access its operations. + * @return the AlertRuleIncidentsInner object. + */ + public AlertRuleIncidentsInner alertRuleIncidents() { + return this.alertRuleIncidents; + } + + /** + * The AlertRulesInner object to access its operations. + */ + private AlertRulesInner alertRules; + + /** + * Gets the AlertRulesInner object to access its operations. + * @return the AlertRulesInner object. + */ + public AlertRulesInner alertRules() { + return this.alertRules; + } + + /** + * The LogProfilesInner object to access its operations. + */ + private LogProfilesInner logProfiles; + + /** + * Gets the LogProfilesInner object to access its operations. + * @return the LogProfilesInner object. + */ + public LogProfilesInner logProfiles() { + return this.logProfiles; + } + + /** + * The DiagnosticSettingsInner object to access its operations. + */ + private DiagnosticSettingsInner diagnosticSettings; + + /** + * Gets the DiagnosticSettingsInner object to access its operations. + * @return the DiagnosticSettingsInner object. + */ + public DiagnosticSettingsInner diagnosticSettings() { + return this.diagnosticSettings; + } + + /** + * The DiagnosticSettingsCategorysInner object to access its operations. + */ + private DiagnosticSettingsCategorysInner diagnosticSettingsCategorys; + + /** + * Gets the DiagnosticSettingsCategorysInner object to access its operations. + * @return the DiagnosticSettingsCategorysInner object. + */ + public DiagnosticSettingsCategorysInner diagnosticSettingsCategorys() { + return this.diagnosticSettingsCategorys; + } + + /** + * The ActionGroupsInner object to access its operations. + */ + private ActionGroupsInner actionGroups; + + /** + * Gets the ActionGroupsInner object to access its operations. + * @return the ActionGroupsInner object. + */ + public ActionGroupsInner actionGroups() { + return this.actionGroups; + } + + /** + * The ActivityLogAlertsInner object to access its operations. + */ + private ActivityLogAlertsInner activityLogAlerts; + + /** + * Gets the ActivityLogAlertsInner object to access its operations. + * @return the ActivityLogAlertsInner object. + */ + public ActivityLogAlertsInner activityLogAlerts() { + return this.activityLogAlerts; + } + + /** + * The ActivityLogsInner object to access its operations. + */ + private ActivityLogsInner activityLogs; + + /** + * Gets the ActivityLogsInner object to access its operations. + * @return the ActivityLogsInner object. + */ + public ActivityLogsInner activityLogs() { + return this.activityLogs; + } + + /** + * The EventCategoriesInner object to access its operations. + */ + private EventCategoriesInner eventCategories; + + /** + * Gets the EventCategoriesInner object to access its operations. + * @return the EventCategoriesInner object. + */ + public EventCategoriesInner eventCategories() { + return this.eventCategories; + } + + /** + * The TenantActivityLogsInner object to access its operations. + */ + private TenantActivityLogsInner tenantActivityLogs; + + /** + * Gets the TenantActivityLogsInner object to access its operations. + * @return the TenantActivityLogsInner object. + */ + public TenantActivityLogsInner tenantActivityLogs() { + return this.tenantActivityLogs; + } + + /** + * The MetricDefinitionsInner object to access its operations. + */ + private MetricDefinitionsInner metricDefinitions; + + /** + * Gets the MetricDefinitionsInner object to access its operations. + * @return the MetricDefinitionsInner object. + */ + public MetricDefinitionsInner metricDefinitions() { + return this.metricDefinitions; + } + + /** + * The MetricsInner object to access its operations. + */ + private MetricsInner metrics; + + /** + * Gets the MetricsInner object to access its operations. + * @return the MetricsInner object. + */ + public MetricsInner metrics() { + return this.metrics; + } + + /** + * The MetricBaselinesInner object to access its operations. + */ + private MetricBaselinesInner metricBaselines; + + /** + * Gets the MetricBaselinesInner object to access its operations. + * @return the MetricBaselinesInner object. + */ + public MetricBaselinesInner metricBaselines() { + return this.metricBaselines; + } + + /** + * The MetricAlertsInner object to access its operations. + */ + private MetricAlertsInner metricAlerts; + + /** + * Gets the MetricAlertsInner object to access its operations. + * @return the MetricAlertsInner object. + */ + public MetricAlertsInner metricAlerts() { + return this.metricAlerts; + } + + /** + * The MetricAlertsStatusInner object to access its operations. + */ + private MetricAlertsStatusInner metricAlertsStatus; + + /** + * Gets the MetricAlertsStatusInner object to access its operations. + * @return the MetricAlertsStatusInner object. + */ + public MetricAlertsStatusInner metricAlertsStatus() { + return this.metricAlertsStatus; + } + + /** + * The ScheduledQueryRulesInner object to access its operations. + */ + private ScheduledQueryRulesInner scheduledQueryRules; + + /** + * Gets the ScheduledQueryRulesInner object to access its operations. + * @return the ScheduledQueryRulesInner object. + */ + public ScheduledQueryRulesInner scheduledQueryRules() { + return this.scheduledQueryRules; + } + + /** + * The MetricNamespacesInner object to access its operations. + */ + private MetricNamespacesInner metricNamespaces; + + /** + * Gets the MetricNamespacesInner object to access its operations. + * @return the MetricNamespacesInner object. + */ + public MetricNamespacesInner metricNamespaces() { + return this.metricNamespaces; + } + + /** + * The VMInsightsInner object to access its operations. + */ + private VMInsightsInner vMInsights; + + /** + * Gets the VMInsightsInner object to access its operations. + * @return the VMInsightsInner object. + */ + public VMInsightsInner vMInsights() { + return this.vMInsights; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.autoscaleSettings = new AutoscaleSettingsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.alertRuleIncidents = new AlertRuleIncidentsInner(restClient().retrofit(), this); + this.alertRules = new AlertRulesInner(restClient().retrofit(), this); + this.logProfiles = new LogProfilesInner(restClient().retrofit(), this); + this.diagnosticSettings = new DiagnosticSettingsInner(restClient().retrofit(), this); + this.diagnosticSettingsCategorys = new DiagnosticSettingsCategorysInner(restClient().retrofit(), this); + this.actionGroups = new ActionGroupsInner(restClient().retrofit(), this); + this.activityLogAlerts = new ActivityLogAlertsInner(restClient().retrofit(), this); + this.activityLogs = new ActivityLogsInner(restClient().retrofit(), this); + this.eventCategories = new EventCategoriesInner(restClient().retrofit(), this); + this.tenantActivityLogs = new TenantActivityLogsInner(restClient().retrofit(), this); + this.metricDefinitions = new MetricDefinitionsInner(restClient().retrofit(), this); + this.metrics = new MetricsInner(restClient().retrofit(), this); + this.metricBaselines = new MetricBaselinesInner(restClient().retrofit(), this); + this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); + this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); + this.scheduledQueryRules = new ScheduledQueryRulesInner(restClient().retrofit(), this); + this.metricNamespaces = new MetricNamespacesInner(restClient().retrofit(), this); + this.vMInsights = new VMInsightsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s)", super.userAgent(), "MonitorManagementClient"); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java new file mode 100644 index 000000000000..f7675f7dad31 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft Insights API operation definition. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java new file mode 100644 index 000000000000..1fed04223963 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationListResultInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the request to list Microsoft.Insights operations. It contains a + * list of operations and a URL link to get the next set of results. + */ +public class OperationListResultInner { + /** + * List of operations supported by the Microsoft.Insights provider. + */ + @JsonProperty(value = "value") + private List value; + + /** + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get list of operations supported by the Microsoft.Insights provider. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set list of operations supported by the Microsoft.Insights provider. + * + * @param value the value value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get uRL to get the next set of operation list results if there are any. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set uRL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationsInner.java new file mode 100644 index 000000000000..b82d476185bf --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/OperationsInner.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.Operations list" }) + @GET("providers/microsoft.insights/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationListResultInner object if successful. + */ + public OperationListResultInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, OperationListResultInner>() { + @Override + public OperationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationListResultInner object + */ + public Observable> listWithServiceResponseAsync() { + final String apiVersion = "2015-04-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws CloudException, IOException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl.java new file mode 100644 index 000000000000..5e524e5180b8 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl1.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl1.java new file mode 100644 index 000000000000..48a6ee2453fb --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java new file mode 100644 index 000000000000..35007f0c9a1e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ResponseInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import org.joda.time.Period; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a metrics query. + */ +public class ResponseInner { + /** + * The integer value representing the cost of the query, for data case. + */ + @JsonProperty(value = "cost") + private Double cost; + + /** + * The timespan for which the data was retrieved. Its value consists of two + * datetimes concatenated, separated by '/'. This may be adjusted in the + * future and returned back from what was originally requested. + */ + @JsonProperty(value = "timespan", required = true) + private String timespan; + + /** + * The interval (window size) for which the metric data was returned in. + * This may be adjusted in the future and returned back from what was + * originally requested. This is not present if a metadata request was + * made. + */ + @JsonProperty(value = "interval") + private Period interval; + + /** + * The namespace of the metrics been queried. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /** + * The region of the resource been queried for metrics. + */ + @JsonProperty(value = "resourceregion") + private String resourceregion; + + /** + * the value of the collection. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the integer value representing the cost of the query, for data case. + * + * @return the cost value + */ + public Double cost() { + return this.cost; + } + + /** + * Set the integer value representing the cost of the query, for data case. + * + * @param cost the cost value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withCost(Double cost) { + this.cost = cost; + return this; + } + + /** + * Get the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @param timespan the timespan value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @return the interval value + */ + public Period interval() { + return this.interval; + } + + /** + * Set the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @param interval the interval value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withInterval(Period interval) { + this.interval = interval; + return this; + } + + /** + * Get the namespace of the metrics been queried. + * + * @return the namespace value + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace of the metrics been queried. + * + * @param namespace the namespace value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the region of the resource been queried for metrics. + * + * @return the resourceregion value + */ + public String resourceregion() { + return this.resourceregion; + } + + /** + * Set the region of the resource been queried for metrics. + * + * @param resourceregion the resourceregion value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withResourceregion(String resourceregion) { + this.resourceregion = resourceregion; + return this; + } + + /** + * Get the value of the collection. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value of the collection. + * + * @param value the value value to set + * @return the ResponseInner object itself. + */ + public ResponseInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java new file mode 100644 index 000000000000..762b7c1f533e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java @@ -0,0 +1,771 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.management.monitor.LogSearchRuleResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ScheduledQueryRules. + */ +public class ScheduledQueryRulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ScheduledQueryRulesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ScheduledQueryRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ScheduledQueryRulesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ScheduledQueryRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ScheduledQueryRules to be + * used by Retrofit to perform actually REST calls. + */ + interface ScheduledQueryRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body LogSearchRuleResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body LogSearchRuleResourcePatch parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.ScheduledQueryRules listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-04-16"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner update(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-04-16"; + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a subscription group. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.list(this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList list(String filter) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync(filter).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(filter), serviceCallback); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listAsync(String filter) { + return listWithServiceResponseAsync(filter).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync(String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.list(this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName, String filter) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName, String filter) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName, String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/TenantActivityLogsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/TenantActivityLogsInner.java new file mode 100644 index 000000000000..7d27af70a19f --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/TenantActivityLogsInner.java @@ -0,0 +1,388 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TenantActivityLogs. + */ +public class TenantActivityLogsInner { + /** The Retrofit service to perform REST calls. */ + private TenantActivityLogsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of TenantActivityLogsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TenantActivityLogsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(TenantActivityLogsService.class); + this.client = client; + } + + /** + * The interface defining all the services for TenantActivityLogs to be + * used by Retrofit to perform actually REST calls. + */ + interface TenantActivityLogsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.TenantActivityLogs list" }) + @GET("providers/microsoft.insights/eventtypes/management/values") + Observable> list(@Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$select") String select, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.TenantActivityLogs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String apiVersion = "2015-04-01"; + final String filter = null; + final String select = null; + return service.list(apiVersion, filter, select, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param filter Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList list(final String filter, final String select) { + ServiceResponse> response = listSinglePageAsync(filter, select).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param filter Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final String select, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, select), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param filter Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listAsync(final String filter, final String select) { + return listWithServiceResponseAsync(filter, select) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param filter Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final String select) { + return listSinglePageAsync(filter, select) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + ServiceResponse> * @param filter Reduces the set of data collected. <br>The **$filter** is very restricted and allows only the following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq '<ResourceProviderName>'.<br>- List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, Operation' and correlationId eq '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + ServiceResponse> * @param select Used to fetch events with only the given properties.<br>The **$select** argument is a comma separated list of property names to be returned. Possible values are: *authorization*, *claims*, *correlationId*, *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, *subStatus*, *subscriptionId* + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final String select) { + final String apiVersion = "2015-04-01"; + return service.list(apiVersion, filter, select, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EventDataInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EventDataInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>One thing to point out here is that this API does *not* retrieve the logs at the individual subscription of the tenant but only surfaces the logs that were generated at the tenant level. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EventDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsInner.java new file mode 100644 index 000000000000..36e2e1eb6085 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsInner.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.ResponseWithErrorException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in VMInsights. + */ +public class VMInsightsInner { + /** The Retrofit service to perform REST calls. */ + private VMInsightsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of VMInsightsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VMInsightsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(VMInsightsService.class); + this.client = client; + } + + /** + * The interface defining all the services for VMInsights to be + * used by Retrofit to perform actually REST calls. + */ + interface VMInsightsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.VMInsights getOnboardingStatus" }) + @GET("{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default") + Observable> getOnboardingStatus(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ResponseWithErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VMInsightsOnboardingStatusInner object if successful. + */ + public VMInsightsOnboardingStatusInner getOnboardingStatus(String resourceUri) { + return getOnboardingStatusWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getOnboardingStatusAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getOnboardingStatusWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VMInsightsOnboardingStatusInner object + */ + public Observable getOnboardingStatusAsync(String resourceUri) { + return getOnboardingStatusWithServiceResponseAsync(resourceUri).map(new Func1, VMInsightsOnboardingStatusInner>() { + @Override + public VMInsightsOnboardingStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VMInsightsOnboardingStatusInner object + */ + public Observable> getOnboardingStatusWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + final String apiVersion = "2018-11-27-preview"; + return service.getOnboardingStatus(resourceUri, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getOnboardingStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getOnboardingStatusDelegate(Response response) throws ResponseWithErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ResponseWithErrorException.class) + .build(response); + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsOnboardingStatusInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsOnboardingStatusInner.java new file mode 100644 index 000000000000..86168840b824 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/VMInsightsOnboardingStatusInner.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.OnboardingStatus; +import com.microsoft.azure.management.monitor.DataStatus; +import java.util.List; +import com.microsoft.azure.management.monitor.DataContainer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * VM Insights onboarding status for a resource. + */ +@JsonFlatten +public class VMInsightsOnboardingStatusInner extends ProxyResource { + /** + * Azure Resource Manager identifier of the resource whose onboarding + * status is being represented. + */ + @JsonProperty(value = "properties.resourceId", required = true) + private String resourceId; + + /** + * The onboarding status for the resource. Note that, a higher level scope, + * e.g., resource group or subscription, is considered onboarded if at + * least one resource under it is onboarded. Possible values include: + * 'onboarded', 'notOnboarded', 'unknown'. + */ + @JsonProperty(value = "properties.onboardingStatus", required = true) + private OnboardingStatus onboardingStatus; + + /** + * The status of VM Insights data from the resource. When reported as + * `present` the data array will contain information about the data + * containers to which data for the specified resource is being routed. + * Possible values include: 'present', 'notPresent'. + */ + @JsonProperty(value = "properties.dataStatus", required = true) + private DataStatus dataStatus; + + /** + * Containers that currently store VM Insights data for the specified + * resource. + */ + @JsonProperty(value = "properties.data") + private List data; + + /** + * Get azure Resource Manager identifier of the resource whose onboarding status is being represented. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set azure Resource Manager identifier of the resource whose onboarding status is being represented. + * + * @param resourceId the resourceId value to set + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'onboarded', 'notOnboarded', 'unknown'. + * + * @return the onboardingStatus value + */ + public OnboardingStatus onboardingStatus() { + return this.onboardingStatus; + } + + /** + * Set the onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, is considered onboarded if at least one resource under it is onboarded. Possible values include: 'onboarded', 'notOnboarded', 'unknown'. + * + * @param onboardingStatus the onboardingStatus value to set + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withOnboardingStatus(OnboardingStatus onboardingStatus) { + this.onboardingStatus = onboardingStatus; + return this; + } + + /** + * Get the status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'present', 'notPresent'. + * + * @return the dataStatus value + */ + public DataStatus dataStatus() { + return this.dataStatus; + } + + /** + * Set the status of VM Insights data from the resource. When reported as `present` the data array will contain information about the data containers to which data for the specified resource is being routed. Possible values include: 'present', 'notPresent'. + * + * @param dataStatus the dataStatus value to set + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withDataStatus(DataStatus dataStatus) { + this.dataStatus = dataStatus; + return this; + } + + /** + * Get containers that currently store VM Insights data for the specified resource. + * + * @return the data value + */ + public List data() { + return this.data; + } + + /** + * Set containers that currently store VM Insights data for the specified resource. + * + * @param data the data value to set + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withData(List data) { + this.data = data; + return this; + } + +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/package-info.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/package-info.java new file mode 100644 index 000000000000..ad7dc55f7089 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.implementation; diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java new file mode 100644 index 000000000000..fdcbdcf73390 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor;