From 3fc78ba30ae58ce276380a70f82856fc7e398813 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 12 Apr 2018 12:24:26 +0000 Subject: [PATCH 1/5] Generated from 2e4c790d16eb6be9299db7a75798bca1697fd5e9 Added GA API version for Scheduled Query Rule Added GA API version for Scheduled Query Rule --- .../azure/management/monitor/Action.java | 8 + .../management/monitor/AlertSeverity.java | 47 ++ .../azure/management/monitor/AlertStatus.java | 64 +-- .../management/monitor/AlertingAction.java | 156 ++++++ .../management/monitor/AzNsActionGroup.java | 96 ++++ .../monitor/ConditionalOperator.java | 44 ++ .../azure/management/monitor/Enabled.java | 41 ++ .../management/monitor/MetricTrigger.java | 80 +++ .../management/monitor/MetricTriggerType.java | 41 ++ .../azure/management/monitor/QueryType.java | 41 ++ .../azure/management/monitor/Schedule.java | 70 +++ .../azure/management/monitor/SkuType.java | 44 ++ .../azure/management/monitor/Source.java | 124 +++++ .../management/monitor/TriggerCondition.java | 96 ++++ .../LogSearchRuleResourceInner.java | 213 ++++++++ .../MonitorManagementClientImpl.java | 471 ++++++++++++++++++ 16 files changed, 1590 insertions(+), 46 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTriggerType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java 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 index e174b47cd5e..0e5bf9cb828 100644 --- 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 @@ -10,10 +10,18 @@ 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; /** * An alert action. */ +@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) +}) public class Action { /** * the id of the action group to use. 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 00000000000..fcf0c43750d --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.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 AlertSeverity. + */ +public final class AlertSeverity extends ExpandableStringEnum { + /** 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/AlertStatus.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java index 14de61e2de6..70f280e0124 100644 --- a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertStatus.java @@ -8,62 +8,34 @@ package com.microsoft.azure.management.monitor; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; /** - * An alert status. + * Defines values for AlertStatus. */ -public class AlertStatus { - /** - * status value. - */ - @JsonProperty(value = "value") - private String value; +public final class AlertStatus extends ExpandableStringEnum { + /** Static value Active for AlertStatus. */ + public static final AlertStatus ACTIVE = fromString("Active"); - /** - * UTC time when the status was checked. - */ - @JsonProperty(value = "timestamp") - private String timestamp; + /** Static value Inactive for AlertStatus. */ + public static final AlertStatus INACTIVE = fromString("Inactive"); /** - * Get the value value. - * - * @return the value value + * Creates or finds a AlertStatus from its string representation. + * @param name a name to look for + * @return the corresponding AlertStatus */ - public String value() { - return this.value; + @JsonCreator + public static AlertStatus fromString(String name) { + return fromString(name, AlertStatus.class); } /** - * Set the value value. - * - * @param value the value value to set - * @return the AlertStatus object itself. + * @return known AlertStatus values */ - public AlertStatus withValue(String value) { - this.value = value; - return this; + public static Collection values() { + return values(AlertStatus.class); } - - /** - * Get the timestamp value. - * - * @return the timestamp value - */ - public String timestamp() { - return this.timestamp; - } - - /** - * Set the timestamp value. - * - * @param timestamp the timestamp value to set - * @return the AlertStatus object itself. - */ - public AlertStatus withTimestamp(String timestamp) { - this.timestamp = timestamp; - return this; - } - } 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 00000000000..3b33b6ce836 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.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; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * The AlertingAction model. + */ +@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 { + /** + * Last time the rule was fired in IS08601 format. + */ + @JsonProperty(value = "lastFiredTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastFiredTime; + + /** + * Severity of the alert. Possible values include: '1', '2', '3', '4'. + */ + @JsonProperty(value = "severity") + private AlertSeverity severity; + + /** + * Alert state. Possible values include: 'Active', 'Inactive'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private AlertStatus status; + + /** + * azns notification group reference. + */ + @JsonProperty(value = "aznsAction", required = true) + private AzNsActionGroup aznsAction; + + /** + * Time untill alert should not be fired in ISO8601 format. + */ + @JsonProperty(value = "throttleTillDate") + private DateTime throttleTillDate; + + /** + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get the lastFiredTime value. + * + * @return the lastFiredTime value + */ + public String lastFiredTime() { + return this.lastFiredTime; + } + + /** + * Get the severity value. + * + * @return the severity value + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity value. + * + * @param severity the severity value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public AlertStatus status() { + return this.status; + } + + /** + * Get the aznsAction value. + * + * @return the aznsAction value + */ + public AzNsActionGroup aznsAction() { + return this.aznsAction; + } + + /** + * Set the aznsAction value. + * + * @param aznsAction the aznsAction value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { + this.aznsAction = aznsAction; + return this; + } + + /** + * Get the throttleTillDate value. + * + * @return the throttleTillDate value + */ + public DateTime throttleTillDate() { + return this.throttleTillDate; + } + + /** + * Set the throttleTillDate value. + * + * @param throttleTillDate the throttleTillDate value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottleTillDate(DateTime throttleTillDate) { + this.throttleTillDate = throttleTillDate; + return this; + } + + /** + * Get the trigger value. + * + * @return the trigger value + */ + public TriggerCondition trigger() { + return this.trigger; + } + + /** + * Set the trigger value. + * + * @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/AzNsActionGroup.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AzNsActionGroup.java new file mode 100644 index 00000000000..fad5cef0605 --- /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; + +/** + * azns notification group. + */ +public class AzNsActionGroup { + /** + * azns notification group reference. + */ + @JsonProperty(value = "actionGroup") + private List actionGroup; + + /** + * Custom subject for Azns email. + */ + @JsonProperty(value = "emailSubject") + private String emailSubject; + + /** + * Custom webhook payload to be send to azns action group. + */ + @JsonProperty(value = "customWebhookPayload") + private String customWebhookPayload; + + /** + * Get the actionGroup value. + * + * @return the actionGroup value + */ + public List actionGroup() { + return this.actionGroup; + } + + /** + * Set the actionGroup value. + * + * @param actionGroup the actionGroup value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withActionGroup(List actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + /** + * Get the emailSubject value. + * + * @return the emailSubject value + */ + public String emailSubject() { + return this.emailSubject; + } + + /** + * Set the emailSubject value. + * + * @param emailSubject the emailSubject value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withEmailSubject(String emailSubject) { + this.emailSubject = emailSubject; + return this; + } + + /** + * Get the customWebhookPayload value. + * + * @return the customWebhookPayload value + */ + public String customWebhookPayload() { + return this.customWebhookPayload; + } + + /** + * Set the customWebhookPayload value. + * + * @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/ConditionalOperator.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ConditionalOperator.java new file mode 100644 index 00000000000..a853f79cd0f --- /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/Enabled.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Enabled.java new file mode 100644 index 00000000000..7f7eebb1c20 --- /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/MetricTrigger.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/MetricTrigger.java index a3556ef56ee..4cbb583aa65 100644 --- 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 @@ -72,6 +72,26 @@ public class MetricTrigger { @JsonProperty(value = "threshold", required = true) private double threshold; + /** + * Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator") + private ConditionalOperator thresholdOperator; + + /** + * 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 the metricName value. * @@ -232,4 +252,64 @@ public MetricTrigger withThreshold(double threshold) { return this; } + /** + * Get the thresholdOperator value. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator value. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the metricTriggerType value. + * + * @return the metricTriggerType value + */ + public MetricTriggerType metricTriggerType() { + return this.metricTriggerType; + } + + /** + * Set the metricTriggerType value. + * + * @param metricTriggerType the metricTriggerType value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricTriggerType(MetricTriggerType metricTriggerType) { + this.metricTriggerType = metricTriggerType; + return this; + } + + /** + * Get the metricColumn value. + * + * @return the metricColumn value + */ + public String metricColumn() { + return this.metricColumn; + } + + /** + * Set the metricColumn value. + * + * @param metricColumn the metricColumn value to set + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricColumn(String metricColumn) { + this.metricColumn = metricColumn; + 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 00000000000..8df88be4b0e --- /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/QueryType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java new file mode 100644 index 00000000000..5116fe3b65c --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.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 QueryType. + */ +public final class QueryType extends ExpandableStringEnum { + /** Static value ResultCount for QueryType. */ + public static final QueryType RESULT_COUNT = fromString("ResultCount"); + + /** Static value Number for QueryType. */ + public static final QueryType NUMBER = fromString("Number"); + + /** + * 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/Schedule.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Schedule.java new file mode 100644 index 00000000000..ef2ff407afe --- /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 the frequencyInMinutes value. + * + * @return the frequencyInMinutes value + */ + public int frequencyInMinutes() { + return this.frequencyInMinutes; + } + + /** + * Set the frequencyInMinutes value. + * + * @param frequencyInMinutes the frequencyInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withFrequencyInMinutes(int frequencyInMinutes) { + this.frequencyInMinutes = frequencyInMinutes; + return this; + } + + /** + * Get the timeWindowInMinutes value. + * + * @return the timeWindowInMinutes value + */ + public int timeWindowInMinutes() { + return this.timeWindowInMinutes; + } + + /** + * Set the timeWindowInMinutes value. + * + * @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/SkuType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.java new file mode 100644 index 00000000000..4c057fe4e02 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/SkuType.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 SkuType. + */ +public final class SkuType extends ExpandableStringEnum { + /** Static value L1 for SkuType. */ + public static final SkuType L1 = fromString("L1"); + + /** Static value L2 for SkuType. */ + public static final SkuType L2 = fromString("L2"); + + /** Static value L3 for SkuType. */ + public static final SkuType L3 = fromString("L3"); + + /** + * Creates or finds a SkuType from its string representation. + * @param name a name to look for + * @return the corresponding SkuType + */ + @JsonCreator + public static SkuType fromString(String name) { + return fromString(name, SkuType.class); + } + + /** + * @return known SkuType values + */ + public static Collection values() { + return values(SkuType.class); + } +} 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 00000000000..d293cbbab93 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Source.java @@ -0,0 +1,124 @@ +/** + * 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. + */ + @JsonProperty(value = "query", required = true) + 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 if query should be returning search result + * count. Set it to Number if its a metric query. Possible values include: + * 'ResultCount', 'Number'. + */ + @JsonProperty(value = "queryType") + private QueryType queryType; + + /** + * Get the query value. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set the query value. + * + * @param query the query value to set + * @return the Source object itself. + */ + public Source withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the authorizedResources value. + * + * @return the authorizedResources value + */ + public List authorizedResources() { + return this.authorizedResources; + } + + /** + * Set the authorizedResources value. + * + * @param authorizedResources the authorizedResources value to set + * @return the Source object itself. + */ + public Source withAuthorizedResources(List authorizedResources) { + this.authorizedResources = authorizedResources; + return this; + } + + /** + * Get the datasourceId value. + * + * @return the datasourceId value + */ + public String datasourceId() { + return this.datasourceId; + } + + /** + * Set the datasourceId value. + * + * @param datasourceId the datasourceId value to set + * @return the Source object itself. + */ + public Source withDatasourceId(String datasourceId) { + this.datasourceId = datasourceId; + return this; + } + + /** + * Get the queryType value. + * + * @return the queryType value + */ + public QueryType queryType() { + return this.queryType; + } + + /** + * Set the queryType value. + * + * @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/TriggerCondition.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/TriggerCondition.java new file mode 100644 index 00000000000..1ea896e30a4 --- /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 MetricTrigger metricTrigger; + + /** + * Get the thresholdOperator value. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator value. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold value. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold value. + * + * @param threshold the threshold value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the metricTrigger value. + * + * @return the metricTrigger value + */ + public MetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set the metricTrigger value. + * + * @param metricTrigger the metricTrigger value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withMetricTrigger(MetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + +} 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 00000000000..640cd2ade19 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java @@ -0,0 +1,213 @@ +/** + * 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 com.microsoft.azure.management.monitor.SkuType; +import org.joda.time.DateTime; +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; + + /** + * SKU Type {L1, L2, L3}. Possible values include: 'L1', 'L2', 'L3'. + */ + @JsonProperty(value = "properties.skuType") + private SkuType skuType; + + /** + * 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 scheduledquery rule. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The source property. + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /** + * The schedule property. + */ + @JsonProperty(value = "properties.schedule", required = true) + private Schedule schedule; + + /** + * The action property. + */ + @JsonProperty(value = "properties.action", required = true) + private Action action; + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the skuType value. + * + * @return the skuType value + */ + public SkuType skuType() { + return this.skuType; + } + + /** + * Set the skuType value. + * + * @param skuType the skuType value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSkuType(SkuType skuType) { + this.skuType = skuType; + return this; + } + + /** + * Get the lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the source value. + * + * @return the source value + */ + public Source source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSource(Source source) { + this.source = source; + return this; + } + + /** + * Get the schedule value. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule value. + * + * @param schedule the schedule value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set the action value. + * + * @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/MonitorManagementClientImpl.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/MonitorManagementClientImpl.java index f41e2cda0ee..621705162cf 100644 --- 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 @@ -8,15 +8,37 @@ package com.microsoft.azure.management.monitor.implementation; +import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.CloudException; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; +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.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; /** * Initializes a new instance of the MonitorManagementClientImpl class. */ public class MonitorManagementClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private MonitorManagementClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -393,6 +415,7 @@ protected void initialize() { this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); + initializeService(); } /** @@ -404,4 +427,452 @@ protected void initialize() { public String userAgent() { return String.format("%s (%s)", super.userAgent(), "MonitorManagementClient"); } + + private void initializeService() { + service = restClient().retrofit().create(MonitorManagementClientService.class); + } + + /** + * The interface defining all the services for MonitorManagementClient to be + * used by Retrofit to perform actually REST calls. + */ + interface MonitorManagementClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MonitorManagementClient createOrUpdateScheduledQueryRules" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> createOrUpdateScheduledQueryRules(@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.MonitorManagementClient getScheduledQueryRule" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> getScheduledQueryRule(@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.MonitorManagementClient deleteScheduledQueryRules" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", method = "DELETE", hasBody = true) + Observable> deleteScheduledQueryRules(@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.MonitorManagementClient getListScheduledQueryRules" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules") + Observable> getListScheduledQueryRules(@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. + Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. + * + * @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 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 LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner createOrUpdateScheduledQueryRules(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an log search rule. + Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. + * + * @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 createOrUpdateScheduledQueryRulesAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an log search rule. + Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. + * + * @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 createOrUpdateScheduledQueryRulesAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an log search rule. + Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. + * + * @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> createOrUpdateScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.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.createOrUpdateScheduledQueryRules(this.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateScheduledQueryRulesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.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 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 LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner getScheduledQueryRule(String resourceGroupName, String ruleName) { + return getScheduledQueryRuleWithServiceResponseAsync(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 getScheduledQueryRuleAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getScheduledQueryRuleWithServiceResponseAsync(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 getScheduledQueryRuleAsync(String resourceGroupName, String ruleName) { + return getScheduledQueryRuleWithServiceResponseAsync(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> getScheduledQueryRuleWithServiceResponseAsync(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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.getScheduledQueryRule(resourceGroupName, ruleName, this.subscriptionId(), apiVersion, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getScheduledQueryRuleDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getScheduledQueryRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.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 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 deleteScheduledQueryRules(String resourceGroupName, String ruleName) { + deleteScheduledQueryRulesWithServiceResponseAsync(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 deleteScheduledQueryRulesAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteScheduledQueryRulesWithServiceResponseAsync(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 deleteScheduledQueryRulesAsync(String resourceGroupName, String ruleName) { + return deleteScheduledQueryRulesWithServiceResponseAsync(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> deleteScheduledQueryRulesWithServiceResponseAsync(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.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.deleteScheduledQueryRules(resourceGroupName, ruleName, this.subscriptionId(), apiVersion, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteScheduledQueryRulesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @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<LogSearchRuleResourceInner> object if successful. + */ + public List getListScheduledQueryRules(String resourceGroupName) { + return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> getListScheduledQueryRulesAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> getListScheduledQueryRulesAsync(String resourceGroupName) { + return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> getListScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.getListScheduledQueryRules(resourceGroupName, this.subscriptionId(), apiVersion, filter, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getListScheduledQueryRulesDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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 + * @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<LogSearchRuleResourceInner> object if successful. + */ + public List getListScheduledQueryRules(String resourceGroupName, String filter) { + return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, filter).toBlocking().single().body(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> getListScheduledQueryRulesAsync(String resourceGroupName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(getListScheduledQueryRulesWithServiceResponseAsync(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 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> getListScheduledQueryRulesAsync(String resourceGroupName, String filter) { + return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> getListScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName, String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.getListScheduledQueryRules(resourceGroupName, this.subscriptionId(), apiVersion, filter, this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getListScheduledQueryRulesDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getListScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } From 49e4c3a9055a880a1cc083fc93721ddd906ab66f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 17 Apr 2018 17:48:14 +0000 Subject: [PATCH 2/5] Generated from d183bad923d3a0a4092d21203f850db6cde9f4e9 Resolving Comments Resolving Comments --- .../management/monitor/AlertSeverity.java | 3 + .../management/monitor/AlertingAction.java | 34 +- .../management/monitor/ProvisioningState.java | 47 ++ .../azure/management/monitor/QueryType.java | 3 - .../azure/management/monitor/Source.java | 2 +- .../LogSearchRuleResourceInner.java | 14 +- .../MonitorManagementClientImpl.java | 485 +------------ .../ScheduledQueryRulesInner.java | 658 ++++++++++++++++++ 8 files changed, 733 insertions(+), 513 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/ProvisioningState.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java 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 index fcf0c43750d..ba4209cd3f1 100644 --- 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 @@ -16,6 +16,9 @@ * 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"); 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 index 3b33b6ce836..460349bf56e 100644 --- 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 @@ -14,29 +14,17 @@ import com.fasterxml.jackson.annotation.JsonTypeName; /** - * The AlertingAction model. + * Specifiy 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 { /** - * Last time the rule was fired in IS08601 format. - */ - @JsonProperty(value = "lastFiredTime", access = JsonProperty.Access.WRITE_ONLY) - private String lastFiredTime; - - /** - * Severity of the alert. Possible values include: '1', '2', '3', '4'. + * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. */ @JsonProperty(value = "severity") private AlertSeverity severity; - /** - * Alert state. Possible values include: 'Active', 'Inactive'. - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private AlertStatus status; - /** * azns notification group reference. */ @@ -55,15 +43,6 @@ public class AlertingAction extends Action { @JsonProperty(value = "trigger", required = true) private TriggerCondition trigger; - /** - * Get the lastFiredTime value. - * - * @return the lastFiredTime value - */ - public String lastFiredTime() { - return this.lastFiredTime; - } - /** * Get the severity value. * @@ -84,15 +63,6 @@ public AlertingAction withSeverity(AlertSeverity severity) { return this; } - /** - * Get the status value. - * - * @return the status value - */ - public AlertStatus status() { - return this.status; - } - /** * Get the aznsAction value. * 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 00000000000..5f5d1db1f35 --- /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/QueryType.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java index 5116fe3b65c..40bbcec076e 100644 --- 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 @@ -19,9 +19,6 @@ public final class QueryType extends ExpandableStringEnum { /** Static value ResultCount for QueryType. */ public static final QueryType RESULT_COUNT = fromString("ResultCount"); - /** Static value Number for QueryType. */ - public static final QueryType NUMBER = fromString("Number"); - /** * Creates or finds a QueryType from its string representation. * @param name a name to look for 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 index d293cbbab93..9975f717548 100644 --- 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 @@ -36,7 +36,7 @@ public class Source { /** * Set value to ResultCount if query should be returning search result * count. Set it to Number if its a metric query. Possible values include: - * 'ResultCount', 'Number'. + * 'ResultCount'. */ @JsonProperty(value = "queryType") private QueryType queryType; 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 index 640cd2ade19..7e69c00ea3a 100644 --- 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 @@ -11,6 +11,7 @@ import com.microsoft.azure.management.monitor.Enabled; import com.microsoft.azure.management.monitor.SkuType; 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; @@ -49,25 +50,26 @@ public class LogSearchRuleResourceInner extends Resource { private DateTime lastUpdatedTime; /** - * Provisioning state of the scheduledquery rule. + * Provisioning state of the scheduledquery rule. Possible values include: + * 'Succeeded', 'Deploying', 'Canceled', 'Failed'. */ @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private String provisioningState; + private ProvisioningState provisioningState; /** - * The source property. + * Data Source against which rule will Query Data. */ @JsonProperty(value = "properties.source", required = true) private Source source; /** - * The schedule property. + * Schedule (Frequnecy, Time Window) for rule. */ @JsonProperty(value = "properties.schedule", required = true) private Schedule schedule; /** - * The action property. + * Action needs to be taken on rule execution. */ @JsonProperty(value = "properties.action", required = true) private Action action; @@ -146,7 +148,7 @@ public DateTime lastUpdatedTime() { * * @return the provisioningState value */ - public String provisioningState() { + public ProvisioningState provisioningState() { return this.provisioningState; } 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 index 621705162cf..0dbb43f8d39 100644 --- 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 @@ -8,37 +8,15 @@ package com.microsoft.azure.management.monitor.implementation; -import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.CloudException; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; -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.Path; -import retrofit2.http.PUT; -import retrofit2.http.Query; -import retrofit2.Response; -import rx.functions.Func1; -import rx.Observable; /** * Initializes a new instance of the MonitorManagementClientImpl class. */ public class MonitorManagementClientImpl extends AzureServiceClient { - /** The Retrofit service to perform REST calls. */ - private MonitorManagementClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -363,6 +341,19 @@ 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; + } + /** * Initializes an instance of MonitorManagementClient client. * @@ -414,8 +405,8 @@ protected void initialize() { 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.azureClient = new AzureClient(this); - initializeService(); } /** @@ -427,452 +418,4 @@ protected void initialize() { public String userAgent() { return String.format("%s (%s)", super.userAgent(), "MonitorManagementClient"); } - - private void initializeService() { - service = restClient().retrofit().create(MonitorManagementClientService.class); - } - - /** - * The interface defining all the services for MonitorManagementClient to be - * used by Retrofit to perform actually REST calls. - */ - interface MonitorManagementClientService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.MonitorManagementClient createOrUpdateScheduledQueryRules" }) - @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") - Observable> createOrUpdateScheduledQueryRules(@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.MonitorManagementClient getScheduledQueryRule" }) - @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") - Observable> getScheduledQueryRule(@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.MonitorManagementClient deleteScheduledQueryRules" }) - @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}", method = "DELETE", hasBody = true) - Observable> deleteScheduledQueryRules(@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.MonitorManagementClient getListScheduledQueryRules" }) - @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules") - Observable> getListScheduledQueryRules(@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. - Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. - * - * @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 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 LogSearchRuleResourceInner object if successful. - */ - public LogSearchRuleResourceInner createOrUpdateScheduledQueryRules(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { - return createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); - } - - /** - * Creates or updates an log search rule. - Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. - * - * @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 createOrUpdateScheduledQueryRulesAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); - } - - /** - * Creates or updates an log search rule. - Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. - * - * @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 createOrUpdateScheduledQueryRulesAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { - return createOrUpdateScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { - @Override - public LogSearchRuleResourceInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates or updates an log search rule. - Request method: PUT Request URI: https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/scheduledQueryRules/{logsearch-rule-name}?api-version={api-version}. - * - * @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> createOrUpdateScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { - if (this.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.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.createOrUpdateScheduledQueryRules(this.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.acceptLanguage(), this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = createOrUpdateScheduledQueryRulesDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse createOrUpdateScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(201, new TypeToken() { }.getType()) - .registerError(CloudException.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 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 LogSearchRuleResourceInner object if successful. - */ - public LogSearchRuleResourceInner getScheduledQueryRule(String resourceGroupName, String ruleName) { - return getScheduledQueryRuleWithServiceResponseAsync(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 getScheduledQueryRuleAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getScheduledQueryRuleWithServiceResponseAsync(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 getScheduledQueryRuleAsync(String resourceGroupName, String ruleName) { - return getScheduledQueryRuleWithServiceResponseAsync(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> getScheduledQueryRuleWithServiceResponseAsync(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.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); - } - final String apiVersion = "2018-04-16"; - return service.getScheduledQueryRule(resourceGroupName, ruleName, this.subscriptionId(), apiVersion, this.acceptLanguage(), this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = getScheduledQueryRuleDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse getScheduledQueryRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(404, new TypeToken() { }.getType()) - .registerError(CloudException.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 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 deleteScheduledQueryRules(String resourceGroupName, String ruleName) { - deleteScheduledQueryRulesWithServiceResponseAsync(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 deleteScheduledQueryRulesAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteScheduledQueryRulesWithServiceResponseAsync(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 deleteScheduledQueryRulesAsync(String resourceGroupName, String ruleName) { - return deleteScheduledQueryRulesWithServiceResponseAsync(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> deleteScheduledQueryRulesWithServiceResponseAsync(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.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); - } - final String apiVersion = "2018-04-16"; - return service.deleteScheduledQueryRules(resourceGroupName, ruleName, this.subscriptionId(), apiVersion, this.acceptLanguage(), this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = deleteScheduledQueryRulesDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse deleteScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(204, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * List the Log Search rules within a resource group. - * - * @param resourceGroupName The name of the resource group. - * @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<LogSearchRuleResourceInner> object if successful. - */ - public List getListScheduledQueryRules(String resourceGroupName) { - return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName).toBlocking().single().body(); - } - - /** - * 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> getListScheduledQueryRulesAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName), serviceCallback); - } - - /** - * List the Log Search rules within a resource group. - * - * @param resourceGroupName The name of the resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<LogSearchRuleResourceInner> object - */ - public Observable> getListScheduledQueryRulesAsync(String resourceGroupName) { - return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * List the Log Search rules within a resource group. - * - * @param resourceGroupName The name of the resource group. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<LogSearchRuleResourceInner> object - */ - public Observable>> getListScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (this.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); - } - final String apiVersion = "2018-04-16"; - final String filter = null; - return service.getListScheduledQueryRules(resourceGroupName, this.subscriptionId(), apiVersion, filter, this.acceptLanguage(), this.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = getListScheduledQueryRulesDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().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 - * @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<LogSearchRuleResourceInner> object if successful. - */ - public List getListScheduledQueryRules(String resourceGroupName, String filter) { - return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, filter).toBlocking().single().body(); - } - - /** - * 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture> getListScheduledQueryRulesAsync(String resourceGroupName, String filter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(getListScheduledQueryRulesWithServiceResponseAsync(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 - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<LogSearchRuleResourceInner> object - */ - public Observable> getListScheduledQueryRulesAsync(String resourceGroupName, String filter) { - return getListScheduledQueryRulesWithServiceResponseAsync(resourceGroupName, filter).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); - } - - /** - * 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 - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<LogSearchRuleResourceInner> object - */ - public Observable>> getListScheduledQueryRulesWithServiceResponseAsync(String resourceGroupName, String filter) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); - } - if (this.subscriptionId() == null) { - throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); - } - final String apiVersion = "2018-04-16"; - return service.getListScheduledQueryRules(resourceGroupName, this.subscriptionId(), apiVersion, filter, this.acceptLanguage(), this.userAgent()) - .flatMap(new Func1, Observable>>>() { - @Override - public Observable>> call(Response response) { - try { - ServiceResponse> result = getListScheduledQueryRulesDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse> getListScheduledQueryRulesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory()., CloudException>newInstance(this.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/ScheduledQueryRulesInner.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java new file mode 100644 index 00000000000..e63d6c5e591 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java @@ -0,0 +1,658 @@ +/** + * 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.resources.fluentcore.collection.InnerSupportsGet; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; +import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.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 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 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 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.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 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 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.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 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 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 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); + } + + /** + * 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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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); + } + + /** + * 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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().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); + } + +} From 510bac930ba8997973e8bb848446b8c3bc826ec8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 18 Apr 2018 18:15:27 +0000 Subject: [PATCH 3/5] Generated from df40ac3bbf17ea0180dd4adff2af3094065feca0 Made SKU as top level proprty and including generic error response format Couple of changes - 1. Made SKU as top level proprty as mentioned here - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md#put-resource 2. including generic error response format --- .../azure/management/monitor/Sku.java | 44 +++++++++++++++ .../azure/management/monitor/Sku1.java | 44 +++++++++++++++ .../LogSearchRuleResourceInner.java | 54 +++++++++---------- .../ScheduledQueryRulesInner.java | 18 +++---- 4 files changed, 124 insertions(+), 36 deletions(-) create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java create mode 100644 azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.java new file mode 100644 index 00000000000..4f39a05de57 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku.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 Sku. + */ +public final class Sku extends ExpandableStringEnum { + /** Static value L1 for Sku. */ + public static final Sku L1 = fromString("L1"); + + /** Static value L2 for Sku. */ + public static final Sku L2 = fromString("L2"); + + /** Static value L3 for Sku. */ + public static final Sku L3 = fromString("L3"); + + /** + * Creates or finds a Sku from its string representation. + * @param name a name to look for + * @return the corresponding Sku + */ + @JsonCreator + public static Sku fromString(String name) { + return fromString(name, Sku.class); + } + + /** + * @return known Sku values + */ + public static Collection values() { + return values(Sku.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.java new file mode 100644 index 00000000000..d44ef142baa --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/Sku1.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.fasterxml.jackson.annotation.JsonProperty; + +/** + * SKU of rule. + */ +public class Sku1 { + /** + * The name of the SKU (L1, L2, L3). Possible values include: 'L1', 'L2', + * 'L3'. + */ + @JsonProperty(value = "name") + private Sku name; + + /** + * Get the name value. + * + * @return the name value + */ + public Sku name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the Sku1 object itself. + */ + public Sku1 withName(Sku name) { + this.name = name; + return this; + } + +} 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 index 7e69c00ea3a..4823c01bfe1 100644 --- 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 @@ -9,12 +9,12 @@ package com.microsoft.azure.management.monitor.implementation; import com.microsoft.azure.management.monitor.Enabled; -import com.microsoft.azure.management.monitor.SkuType; 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.microsoft.azure.management.monitor.Sku1; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -37,12 +37,6 @@ public class LogSearchRuleResourceInner extends Resource { @JsonProperty(value = "properties.Enabled") private Enabled enabled; - /** - * SKU Type {L1, L2, L3}. Possible values include: 'L1', 'L2', 'L3'. - */ - @JsonProperty(value = "properties.skuType") - private SkuType skuType; - /** * Last time the rule was updated in IS08601 format. */ @@ -74,6 +68,12 @@ public class LogSearchRuleResourceInner extends Resource { @JsonProperty(value = "properties.action", required = true) private Action action; + /** + * Sku of the Log Search Rule. + */ + @JsonProperty(value = "sku") + private Sku1 sku; + /** * Get the description value. * @@ -114,26 +114,6 @@ public LogSearchRuleResourceInner withEnabled(Enabled enabled) { return this; } - /** - * Get the skuType value. - * - * @return the skuType value - */ - public SkuType skuType() { - return this.skuType; - } - - /** - * Set the skuType value. - * - * @param skuType the skuType value to set - * @return the LogSearchRuleResourceInner object itself. - */ - public LogSearchRuleResourceInner withSkuType(SkuType skuType) { - this.skuType = skuType; - return this; - } - /** * Get the lastUpdatedTime value. * @@ -212,4 +192,24 @@ public LogSearchRuleResourceInner withAction(Action action) { return this; } + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku1 sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSku(Sku1 sku) { + this.sku = sku; + 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 index e63d6c5e591..cc27c486319 100644 --- 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 @@ -14,6 +14,7 @@ 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.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -90,7 +91,7 @@ interface ScheduledQueryRulesService { * @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 CloudException thrown if the request is rejected by server + * @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. */ @@ -168,11 +169,11 @@ public Observable> call(Response createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + 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(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } @@ -182,7 +183,7 @@ private ServiceResponse createOrUpdateDelegate(Respo * @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 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. */ @@ -253,11 +254,10 @@ public Observable> call(Response getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) - .register(404, new TypeToken() { }.getType()) - .registerError(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } From faf72d37edd41106ca6b6fc4d4782d7e5c169dfb Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 23 Apr 2018 16:45:15 +0000 Subject: [PATCH 4/5] Generated from 7578160670750a68d05f77ec8163b25bb72f391e MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor Changes to align implementation 1. Removed SKU - Billing Model is still under discussion, hence need not to be exposed to customers. 2. Enabled field ichanged to align with camel case. 3. 'throttleTillDate' in properties.action changed to 'throttlingInMin' to denote correct meaning and it’s data type changed to number instead of date. 4. 'status' to be removed in properties.action from examples. 5. 'severity' made a required field in properties.action. 6. Removed Examples from original spec json --- .../management/monitor/AlertingAction.java | 25 ++++++++-------- .../LogSearchRuleResourceInner.java | 29 +------------------ 2 files changed, 13 insertions(+), 41 deletions(-) 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 index 460349bf56e..f18f5d019b1 100644 --- 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 @@ -8,7 +8,6 @@ package com.microsoft.azure.management.monitor; -import org.joda.time.DateTime; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -22,7 +21,7 @@ public class AlertingAction extends Action { /** * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. */ - @JsonProperty(value = "severity") + @JsonProperty(value = "severity", required = true) private AlertSeverity severity; /** @@ -32,10 +31,10 @@ public class AlertingAction extends Action { private AzNsActionGroup aznsAction; /** - * Time untill alert should not be fired in ISO8601 format. + * time (in minutes) for which Alerts should be throttled. */ - @JsonProperty(value = "throttleTillDate") - private DateTime throttleTillDate; + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; /** * The trigger condition that results in the alert rule being. @@ -84,22 +83,22 @@ public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { } /** - * Get the throttleTillDate value. + * Get the throttlingInMin value. * - * @return the throttleTillDate value + * @return the throttlingInMin value */ - public DateTime throttleTillDate() { - return this.throttleTillDate; + public Integer throttlingInMin() { + return this.throttlingInMin; } /** - * Set the throttleTillDate value. + * Set the throttlingInMin value. * - * @param throttleTillDate the throttleTillDate value to set + * @param throttlingInMin the throttlingInMin value to set * @return the AlertingAction object itself. */ - public AlertingAction withThrottleTillDate(DateTime throttleTillDate) { - this.throttleTillDate = throttleTillDate; + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; return this; } 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 index 4823c01bfe1..6be988338a9 100644 --- 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 @@ -14,7 +14,6 @@ import com.microsoft.azure.management.monitor.Source; import com.microsoft.azure.management.monitor.Schedule; import com.microsoft.azure.management.monitor.Action; -import com.microsoft.azure.management.monitor.Sku1; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.Resource; @@ -34,7 +33,7 @@ public class LogSearchRuleResourceInner extends Resource { * 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") + @JsonProperty(value = "properties.enabled") private Enabled enabled; /** @@ -68,12 +67,6 @@ public class LogSearchRuleResourceInner extends Resource { @JsonProperty(value = "properties.action", required = true) private Action action; - /** - * Sku of the Log Search Rule. - */ - @JsonProperty(value = "sku") - private Sku1 sku; - /** * Get the description value. * @@ -192,24 +185,4 @@ public LogSearchRuleResourceInner withAction(Action action) { return this; } - /** - * Get the sku value. - * - * @return the sku value - */ - public Sku1 sku() { - return this.sku; - } - - /** - * Set the sku value. - * - * @param sku the sku value to set - * @return the LogSearchRuleResourceInner object itself. - */ - public LogSearchRuleResourceInner withSku(Sku1 sku) { - this.sku = sku; - return this; - } - } From a8baadba0074b151ce15715cd66b13b40c5e8360 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 24 Apr 2018 17:50:37 +0000 Subject: [PATCH 5/5] Generated from fb180fb311d73934d0f5150f72638cc3de155ea0 Added Default Response payload in all APIs Changes - 1. Added Default Response payload in all APIs 2. Made azNs description more clear --- .../management/monitor/AzNsActionGroup.java | 2 +- .../ScheduledQueryRulesInner.java | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) 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 index fad5cef0605..b33a01f9236 100644 --- 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 @@ -16,7 +16,7 @@ */ public class AzNsActionGroup { /** - * azns notification group reference. + * Azure Group reference. */ @JsonProperty(value = "actionGroup") private List actionGroup; 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 index cc27c486319..d2da7e63829 100644 --- 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 @@ -13,7 +13,6 @@ import com.microsoft.azure.management.resources.fluentcore.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.Page; import com.microsoft.azure.PagedList; @@ -267,7 +266,7 @@ private ServiceResponse getByResourceGroupDelegate(R * @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 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) { @@ -337,11 +336,11 @@ public Observable> call(Response response) { }); } - private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + 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(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } @@ -486,10 +485,10 @@ public Observable>> call(Respon }); } - private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + 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(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); } @@ -648,10 +647,10 @@ public Observable>> call(Respon }); } - private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + 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(CloudException.class) + .registerError(ErrorResponseException.class) .build(response); }