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..ba4209cd3f1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertSeverity.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AlertSeverity. + */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value 0 for AlertSeverity. */ + public static final AlertSeverity ZERO = fromString("0"); + + /** Static value 1 for AlertSeverity. */ + public static final AlertSeverity ONE = fromString("1"); + + /** Static value 2 for AlertSeverity. */ + public static final AlertSeverity TWO = fromString("2"); + + /** Static value 3 for AlertSeverity. */ + public static final AlertSeverity THREE = fromString("3"); + + /** Static value 4 for AlertSeverity. */ + public static final AlertSeverity FOUR = fromString("4"); + + /** + * Creates or finds a AlertSeverity from its string representation. + * @param name a name to look for + * @return the corresponding AlertSeverity + */ + @JsonCreator + public static AlertSeverity fromString(String name) { + return fromString(name, AlertSeverity.class); + } + + /** + * @return known AlertSeverity values + */ + public static Collection values() { + return values(AlertSeverity.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/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..f18f5d019b1 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/AlertingAction.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * 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 { + /** + * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + */ + @JsonProperty(value = "severity", required = true) + private AlertSeverity severity; + + /** + * azns notification group reference. + */ + @JsonProperty(value = "aznsAction", required = true) + private AzNsActionGroup aznsAction; + + /** + * time (in minutes) for which Alerts should be throttled. + */ + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; + + /** + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get 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 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 throttlingInMin value. + * + * @return the throttlingInMin value + */ + public Integer throttlingInMin() { + return this.throttlingInMin; + } + + /** + * Set the throttlingInMin value. + * + * @param throttlingInMin the throttlingInMin value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; + return this; + } + + /** + * Get the trigger 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..b33a01f9236 --- /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 { + /** + * Azure 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/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 new file mode 100644 index 00000000000..40bbcec076e --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/QueryType.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for QueryType. + */ +public final class QueryType extends ExpandableStringEnum { + /** Static value ResultCount for QueryType. */ + public static final QueryType RESULT_COUNT = fromString("ResultCount"); + + /** + * Creates or finds a QueryType from its string representation. + * @param name a name to look for + * @return the corresponding QueryType + */ + @JsonCreator + public static QueryType fromString(String name) { + return fromString(name, QueryType.class); + } + + /** + * @return known QueryType values + */ + public static Collection values() { + return values(QueryType.class); + } +} diff --git a/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/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/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/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..9975f717548 --- /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'. + */ + @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..6be988338a9 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/LogSearchRuleResourceInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.implementation; + +import com.microsoft.azure.management.monitor.Enabled; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.ProvisioningState; +import com.microsoft.azure.management.monitor.Source; +import com.microsoft.azure.management.monitor.Schedule; +import com.microsoft.azure.management.monitor.Action; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The Log Search Rule resource. + */ +@JsonFlatten +public class LogSearchRuleResourceInner extends Resource { + /** + * The description of the Log Search rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Provisioning state of the scheduledquery rule. Possible values include: + * 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Data Source against which rule will Query Data. + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /** + * Schedule (Frequnecy, Time Window) for rule. + */ + @JsonProperty(value = "properties.schedule", required = true) + private Schedule schedule; + + /** + * Action needs to be taken on rule execution. + */ + @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 lastUpdatedTime value. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public ProvisioningState 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..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 @@ -341,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. * @@ -392,6 +405,7 @@ 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); } 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..d2da7e63829 --- /dev/null +++ b/azure-mgmt-monitor/src/main/java/com/microsoft/azure/management/monitor/implementation/ScheduledQueryRulesInner.java @@ -0,0 +1,657 @@ +/** + * 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.management.monitor.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an log search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2018-04-16"; + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a subscription group. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.list(this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<LogSearchRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2018-04-16"; + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +}