From 1c985702b64d1c5c3e31dd31cb5b48d2ca2ede56 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Fri, 28 Jun 2019 11:03:37 -0700 Subject: [PATCH] Monitor (#4108) * generated v2015_07_01 of monitor * generated v2016_03_01 of monitor * generated v2017_03_01_preview of monitor * generated v2017_04_01 of monitor * generated v2018_03_01 of monitor * generated v2018_04_16 of monitor * generated v2018_09_01 of monitor * formatted pom.xml * Update pom.xml --- monitor/resource-manager/v2015_07_01/pom.xml | 133 +++ .../monitor/v2015_07_01/ErrorResponse.java | 69 ++ .../v2015_07_01/ErrorResponseException.java | 44 + .../monitor/v2015_07_01/LogSettings.java | 98 +++ .../monitor/v2015_07_01/MetricSettings.java | 97 +++ .../monitor/v2015_07_01/RetentionPolicy.java | 70 ++ .../ServiceDiagnosticSettings.java | 39 + .../ServiceDiagnosticSettingsResource.java | 72 ++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/MonitorClientImpl.java | 173 ++++ .../implementation/MonitorManager.java | 96 +++ .../ServiceDiagnosticSettingsImpl.java | 54 ++ .../ServiceDiagnosticSettingsInner.java | 228 +++++ ...ServiceDiagnosticSettingsResourceImpl.java | 80 ++ ...erviceDiagnosticSettingsResourceInner.java | 160 ++++ .../implementation/package-info.java | 11 + .../monitor/v2015_07_01/package-info.java | 11 + monitor/resource-manager/v2016_03_01/pom.xml | 133 +++ .../monitor/v2016_03_01/AggregationType.java | 65 ++ .../v2016_03_01/AlertRuleIncidents.java | 40 + .../v2016_03_01/AlertRuleResource.java | 184 ++++ .../v2016_03_01/AlertRuleResourcePatch.java | 195 +++++ .../monitor/v2016_03_01/AlertRules.java | 25 + .../v2016_03_01/ConditionOperator.java | 59 ++ .../monitor/v2016_03_01/ErrorResponse.java | 69 ++ .../v2016_03_01/ErrorResponseException.java | 44 + .../monitor/v2016_03_01/Incident.java | 46 + .../v2016_03_01/LocalizableString.java | 69 ++ .../LocationThresholdRuleCondition.java | 76 ++ .../v2016_03_01/LogProfileResource.java | 232 ++++++ .../v2016_03_01/LogProfileResourcePatch.java | 185 ++++ .../monitor/v2016_03_01/LogProfiles.java | 40 + .../ManagementEventAggregationCondition.java | 99 +++ .../ManagementEventRuleCondition.java | 50 ++ .../v2016_03_01/MetricAvailability.java | 73 ++ .../monitor/v2016_03_01/MetricDefinition.java | 51 ++ .../v2016_03_01/MetricDefinitions.java | 28 + .../monitor/v2016_03_01/RetentionPolicy.java | 70 ++ .../monitor/v2016_03_01/RuleAction.java | 26 + .../monitor/v2016_03_01/RuleCondition.java | 54 ++ .../monitor/v2016_03_01/RuleDataSource.java | 53 ++ .../monitor/v2016_03_01/RuleEmailAction.java | 77 ++ .../RuleManagementEventClaimsDataSource.java | 43 + .../RuleManagementEventDataSource.java | 258 ++++++ .../v2016_03_01/RuleMetricDataSource.java | 48 ++ .../v2016_03_01/RuleWebhookAction.java | 77 ++ .../v2016_03_01/ThresholdRuleCondition.java | 133 +++ .../v2016_03_01/TimeAggregationOperator.java | 62 ++ .../management/monitor/v2016_03_01/Unit.java | 68 ++ .../AlertRuleIncidentsImpl.java | 65 ++ .../AlertRuleIncidentsInner.java | 250 ++++++ .../implementation/AlertRuleResourceImpl.java | 139 ++++ .../AlertRuleResourceInner.java | 171 ++++ .../implementation/AlertRulesImpl.java | 138 +++ .../implementation/AlertRulesInner.java | 624 ++++++++++++++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/IncidentImpl.java | 59 ++ .../implementation/IncidentInner.java | 94 +++ .../LogProfileResourceImpl.java | 198 +++++ .../LogProfileResourceInner.java | 160 ++++ .../implementation/LogProfilesImpl.java | 96 +++ .../implementation/LogProfilesInner.java | 498 +++++++++++ .../implementation/MetricDefinitionImpl.java | 61 ++ .../implementation/MetricDefinitionInner.java | 184 ++++ .../implementation/MetricDefinitionsImpl.java | 49 ++ .../MetricDefinitionsInner.java | 221 +++++ .../MonitorManagementClientImpl.java | 238 ++++++ .../implementation/MonitorManager.java | 135 +++ .../v2016_03_01/implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 11 + .../monitor/v2016_03_01/package-info.java | 11 + .../v2017_03_01_preview/pom.xml | 133 +++ .../ActivityLogAlertActionGroup.java | 71 ++ .../ActivityLogAlertActionList.java | 44 + .../ActivityLogAlertAllOfCondition.java | 45 + .../ActivityLogAlertLeafCondition.java | 75 ++ .../ActivityLogAlertResource.java | 166 ++++ .../ActivityLogAlertResourcePatch.java | 47 ++ .../ActivityLogAlerts.java | 25 + .../v2017_03_01_preview/ErrorResponse.java | 69 ++ .../ErrorResponseException.java | 44 + .../ActivityLogAlertResourceImpl.java | 129 +++ .../ActivityLogAlertResourceInner.java | 156 ++++ .../implementation/ActivityLogAlertsImpl.java | 138 +++ .../ActivityLogAlertsInner.java | 622 ++++++++++++++ .../implementation/IdParsingUtils.java | 57 ++ .../MonitorManagementClientImpl.java | 196 +++++ .../implementation/MonitorManager.java | 99 +++ .../implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 11 + .../v2017_03_01_preview/package-info.java | 11 + monitor/resource-manager/v2017_04_01/pom.xml | 133 +++ .../v2017_04_01/ActionGroupPatchBody.java | 73 ++ .../v2017_04_01/ActionGroupResource.java | 217 +++++ .../monitor/v2017_04_01/ActionGroups.java | 37 + .../ActivityLogAlertActionGroup.java | 71 ++ .../ActivityLogAlertActionList.java | 44 + .../ActivityLogAlertAllOfCondition.java | 45 + .../ActivityLogAlertLeafCondition.java | 75 ++ .../ActivityLogAlertPatchBody.java | 73 ++ .../v2017_04_01/ActivityLogAlertResource.java | 166 ++++ .../v2017_04_01/ActivityLogAlerts.java | 25 + .../AutomationRunbookReceiver.java | 174 ++++ .../v2017_04_01/AzureAppPushReceiver.java | 70 ++ .../monitor/v2017_04_01/EmailReceiver.java | 86 ++ .../monitor/v2017_04_01/EnableRequest.java | 43 + .../monitor/v2017_04_01/ErrorResponse.java | 69 ++ .../v2017_04_01/ErrorResponseException.java | 44 + .../monitor/v2017_04_01/ItsmReceiver.java | 151 ++++ .../monitor/v2017_04_01/ReceiverStatus.java | 56 ++ .../monitor/v2017_04_01/SmsReceiver.java | 112 +++ .../monitor/v2017_04_01/WebhookReceiver.java | 70 ++ .../ActionGroupResourceImpl.java | 168 ++++ .../ActionGroupResourceInner.java | 237 ++++++ .../implementation/ActionGroupsImpl.java | 144 ++++ .../implementation/ActionGroupsInner.java | 723 ++++++++++++++++ .../ActivityLogAlertResourceImpl.java | 129 +++ .../ActivityLogAlertResourceInner.java | 156 ++++ .../implementation/ActivityLogAlertsImpl.java | 138 +++ .../ActivityLogAlertsInner.java | 622 ++++++++++++++ .../implementation/IdParsingUtils.java | 57 ++ .../MonitorManagementClientImpl.java | 210 +++++ .../implementation/MonitorManager.java | 111 +++ .../v2017_04_01/implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 11 + .../monitor/v2017_04_01/package-info.java | 11 + monitor/resource-manager/v2018_03_01/pom.xml | 133 +++ .../v2018_03_01/ActionGroupPatchBody.java | 73 ++ .../v2018_03_01/ActionGroupResource.java | 268 ++++++ .../monitor/v2018_03_01/ActionGroups.java | 37 + .../AutomationRunbookReceiver.java | 174 ++++ .../v2018_03_01/AzureAppPushReceiver.java | 70 ++ .../v2018_03_01/AzureFunctionReceiver.java | 122 +++ .../v2018_03_01/DynamicMetricCriteria.java | 130 +++ .../DynamicThresholdFailingPeriods.java | 73 ++ .../monitor/v2018_03_01/EmailReceiver.java | 86 ++ .../monitor/v2018_03_01/EnableRequest.java | 43 + .../monitor/v2018_03_01/ErrorResponse.java | 69 ++ .../v2018_03_01/ErrorResponseException.java | 44 + .../monitor/v2018_03_01/ItsmReceiver.java | 151 ++++ .../monitor/v2018_03_01/LogicAppReceiver.java | 96 +++ .../v2018_03_01/MetricAlertAction.java | 70 ++ .../v2018_03_01/MetricAlertCriteria.java | 53 ++ ...ultipleResourceMultipleMetricCriteria.java | 49 ++ .../v2018_03_01/MetricAlertResource.java | 323 +++++++ .../v2018_03_01/MetricAlertResourcePatch.java | 357 ++++++++ ...tSingleResourceMultipleMetricCriteria.java | 49 ++ .../v2018_03_01/MetricAlertStatus.java | 121 +++ .../MetricAlertStatusCollection.java | 26 + .../MetricAlertStatusProperties.java | 97 +++ .../monitor/v2018_03_01/MetricAlerts.java | 25 + .../v2018_03_01/MetricAlertsStatus.java | 40 + .../monitor/v2018_03_01/MetricCriteria.java | 73 ++ .../monitor/v2018_03_01/MetricDimension.java | 96 +++ .../v2018_03_01/MultiMetricCriteria.java | 184 ++++ .../monitor/v2018_03_01/ReceiverStatus.java | 56 ++ .../monitor/v2018_03_01/SmsReceiver.java | 112 +++ .../monitor/v2018_03_01/VoiceReceiver.java | 96 +++ .../monitor/v2018_03_01/WebhookReceiver.java | 70 ++ .../ActionGroupResourceImpl.java | 204 +++++ .../ActionGroupResourceInner.java | 318 +++++++ .../implementation/ActionGroupsImpl.java | 144 ++++ .../implementation/ActionGroupsInner.java | 723 ++++++++++++++++ .../implementation/IdParsingUtils.java | 57 ++ .../MetricAlertResourceImpl.java | 218 +++++ .../MetricAlertResourceInner.java | 333 ++++++++ .../MetricAlertStatusCollectionImpl.java | 40 + .../MetricAlertStatusCollectionInner.java | 45 + .../implementation/MetricAlertsImpl.java | 138 +++ .../implementation/MetricAlertsInner.java | 622 ++++++++++++++ .../MetricAlertsStatusImpl.java | 58 ++ .../MetricAlertsStatusInner.java | 243 ++++++ .../MonitorManagementClientImpl.java | 224 +++++ .../implementation/MonitorManager.java | 123 +++ .../v2018_03_01/implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 11 + .../monitor/v2018_03_01/package-info.java | 11 + monitor/resource-manager/v2018_04_16/pom.xml | 133 +++ .../monitor/v2018_04_16/Action.java | 25 + .../monitor/v2018_04_16/AlertSeverity.java | 50 ++ .../monitor/v2018_04_16/AlertingAction.java | 125 +++ .../monitor/v2018_04_16/AzNsActionGroup.java | 96 +++ .../v2018_04_16/ConditionalOperator.java | 44 + .../monitor/v2018_04_16/Criteria.java | 70 ++ .../monitor/v2018_04_16/Dimension.java | 105 +++ .../monitor/v2018_04_16/Enabled.java | 41 + .../monitor/v2018_04_16/ErrorResponse.java | 69 ++ .../v2018_04_16/ErrorResponseException.java | 44 + .../monitor/v2018_04_16/LogMetricTrigger.java | 123 +++ .../v2018_04_16/LogSearchRuleResource.java | 176 ++++ .../LogSearchRuleResourcePatch.java | 73 ++ .../v2018_04_16/LogToMetricAction.java | 48 ++ .../v2018_04_16/MetricTriggerType.java | 41 + .../v2018_04_16/ProvisioningState.java | 47 ++ .../monitor/v2018_04_16/QueryType.java | 38 + .../monitor/v2018_04_16/Schedule.java | 70 ++ .../v2018_04_16/ScheduledQueryRules.java | 25 + .../monitor/v2018_04_16/Source.java | 122 +++ .../monitor/v2018_04_16/TriggerCondition.java | 96 +++ .../implementation/IdParsingUtils.java | 57 ++ .../LogSearchRuleResourceImpl.java | 142 ++++ .../LogSearchRuleResourceInner.java | 189 +++++ .../implementation/MonitorClientImpl.java | 196 +++++ .../implementation/MonitorManager.java | 99 +++ .../v2018_04_16/implementation/PageImpl.java | 75 ++ .../ScheduledQueryRulesImpl.java | 138 +++ .../ScheduledQueryRulesInner.java | 787 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../monitor/v2018_04_16/package-info.java | 11 + monitor/resource-manager/v2018_09_01/pom.xml | 133 +++ .../v2018_09_01/ActionGroupPatchBody.java | 73 ++ .../v2018_09_01/ActionGroupResource.java | 285 +++++++ .../monitor/v2018_09_01/ActionGroups.java | 37 + .../monitor/v2018_09_01/ArmRoleReceiver.java | 70 ++ .../AutomationRunbookReceiver.java | 174 ++++ .../v2018_09_01/AzureAppPushReceiver.java | 70 ++ .../v2018_09_01/AzureFunctionReceiver.java | 122 +++ .../v2018_09_01/BaselineMetadataValue.java | 69 ++ .../monitor/v2018_09_01/BaselineResponse.java | 69 ++ .../monitor/v2018_09_01/Baselines.java | 28 + .../CalculateBaselineResponse.java | 38 + .../monitor/v2018_09_01/EmailReceiver.java | 86 ++ .../monitor/v2018_09_01/EnableRequest.java | 43 + .../monitor/v2018_09_01/ErrorResponse.java | 69 ++ .../v2018_09_01/ErrorResponseException.java | 44 + .../monitor/v2018_09_01/ItsmReceiver.java | 151 ++++ .../v2018_09_01/LocalizableString.java | 69 ++ .../monitor/v2018_09_01/LogicAppReceiver.java | 96 +++ .../monitor/v2018_09_01/MetricBaselines.java | 39 + .../monitor/v2018_09_01/ReceiverStatus.java | 56 ++ .../monitor/v2018_09_01/ResultType.java | 53 ++ .../monitor/v2018_09_01/Sensitivity.java | 56 ++ .../monitor/v2018_09_01/SmsReceiver.java | 112 +++ .../v2018_09_01/TimeSeriesInformation.java | 97 +++ .../monitor/v2018_09_01/VoiceReceiver.java | 96 +++ .../monitor/v2018_09_01/WebhookReceiver.java | 70 ++ .../ActionGroupResourceImpl.java | 216 +++++ .../ActionGroupResourceInner.java | 346 ++++++++ .../implementation/ActionGroupsImpl.java | 144 ++++ .../implementation/ActionGroupsInner.java | 723 ++++++++++++++++ .../implementation/BaselineInner.java | 98 +++ .../implementation/BaselineResponseImpl.java | 76 ++ .../implementation/BaselineResponseInner.java | 231 +++++ .../implementation/BaselinesImpl.java | 42 + .../implementation/BaselinesInner.java | 247 ++++++ .../CalculateBaselineResponseImpl.java | 43 + .../CalculateBaselineResponseInner.java | 97 +++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/MetricBaselinesImpl.java | 56 ++ .../implementation/MetricBaselinesInner.java | 348 ++++++++ .../MonitorManagementClientImpl.java | 224 +++++ .../implementation/MonitorManager.java | 123 +++ .../v2018_09_01/implementation/PageImpl.java | 75 ++ .../implementation/package-info.java | 11 + .../monitor/v2018_09_01/package-info.java | 11 + 255 files changed, 30489 insertions(+) create mode 100644 monitor/resource-manager/v2015_07_01/pom.xml create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponse.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/LogSettings.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/MetricSettings.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/RetentionPolicy.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettings.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettingsResource.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorClientImpl.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsImpl.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsInner.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceImpl.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceInner.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/package-info.java create mode 100644 monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/package-info.java create mode 100644 monitor/resource-manager/v2016_03_01/pom.xml create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AggregationType.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleIncidents.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResourcePatch.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRules.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ConditionOperator.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponse.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Incident.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocalizableString.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocationThresholdRuleCondition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResourcePatch.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfiles.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventAggregationCondition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventRuleCondition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricAvailability.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinitions.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RetentionPolicy.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleAction.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleCondition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleDataSource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleEmailAction.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventClaimsDataSource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventDataSource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleMetricDataSource.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleWebhookAction.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ThresholdRuleCondition.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/TimeAggregationOperator.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Unit.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsInner.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManagementClientImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/package-info.java create mode 100644 monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/package-info.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/pom.xml create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionGroup.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionList.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertAllOfCondition.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertLeafCondition.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResource.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResourcePatch.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlerts.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponse.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceImpl.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceInner.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsImpl.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsInner.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManagementClientImpl.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/package-info.java create mode 100644 monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/package-info.java create mode 100644 monitor/resource-manager/v2017_04_01/pom.xml create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupPatchBody.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupResource.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroups.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionGroup.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionList.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertAllOfCondition.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertLeafCondition.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertPatchBody.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertResource.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlerts.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AutomationRunbookReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AzureAppPushReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EmailReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EnableRequest.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponse.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ItsmReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ReceiverStatus.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/SmsReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/WebhookReceiver.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceInner.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsInner.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceInner.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsInner.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManagementClientImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/package-info.java create mode 100644 monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/package-info.java create mode 100644 monitor/resource-manager/v2018_03_01/pom.xml create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupPatchBody.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupResource.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroups.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AutomationRunbookReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureAppPushReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureFunctionReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicMetricCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicThresholdFailingPeriods.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EmailReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EnableRequest.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponse.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ItsmReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/LogicAppReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertAction.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertMultipleResourceMultipleMetricCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResource.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResourcePatch.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertSingleResourceMultipleMetricCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatus.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusCollection.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusProperties.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlerts.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertsStatus.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricDimension.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MultiMetricCriteria.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ReceiverStatus.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/SmsReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/VoiceReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/WebhookReceiver.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusInner.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManagementClientImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/package-info.java create mode 100644 monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/package-info.java create mode 100644 monitor/resource-manager/v2018_04_16/pom.xml create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Action.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertSeverity.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertingAction.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AzNsActionGroup.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ConditionalOperator.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Criteria.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Dimension.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Enabled.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponse.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogMetricTrigger.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResource.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResourcePatch.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogToMetricAction.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/MetricTriggerType.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ProvisioningState.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/QueryType.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Schedule.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ScheduledQueryRules.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Source.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/TriggerCondition.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceImpl.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceInner.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorClientImpl.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesImpl.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesInner.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/package-info.java create mode 100644 monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/package-info.java create mode 100644 monitor/resource-manager/v2018_09_01/pom.xml create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupPatchBody.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupResource.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroups.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ArmRoleReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AutomationRunbookReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureAppPushReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureFunctionReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineMetadataValue.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineResponse.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Baselines.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/CalculateBaselineResponse.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EmailReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EnableRequest.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponse.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponseException.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ItsmReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LocalizableString.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LogicAppReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/MetricBaselines.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ReceiverStatus.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ResultType.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Sensitivity.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/SmsReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/TimeSeriesInformation.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/VoiceReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/WebhookReceiver.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/IdParsingUtils.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesInner.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManagementClientImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManager.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/PageImpl.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/package-info.java create mode 100644 monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/package-info.java diff --git a/monitor/resource-manager/v2015_07_01/pom.xml b/monitor/resource-manager/v2015_07_01/pom.xml new file mode 100644 index 0000000000000..68bc87e4d7fe1 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2015_07_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponse.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponse.java new file mode 100644 index 0000000000000..c8200799676b6 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponseException.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponseException.java new file mode 100644 index 0000000000000..9cbb0f2694665 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/LogSettings.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/LogSettings.java new file mode 100644 index 0000000000000..4fae491586c0e --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/LogSettings.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular log. + */ +public class LogSettings { + /** + * Name of a Diagnostic Log category for a resource type this setting is + * applied to. To obtain the list of Diagnostic Log categories for a + * resource, first perform a GET diagnostic settings operation. + */ + @JsonProperty(value = "category") + private String category; + + /** + * a value indicating whether this log is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the retention policy for this log. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** + * Get name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation. + * + * @param category the category value to set + * @return the LogSettings object itself. + */ + public LogSettings withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get a value indicating whether this log is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether this log is enabled. + * + * @param enabled the enabled value to set + * @return the LogSettings object itself. + */ + public LogSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retention policy for this log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for this log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogSettings object itself. + */ + public LogSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/MetricSettings.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/MetricSettings.java new file mode 100644 index 0000000000000..7e8ba79783363 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/MetricSettings.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Part of MultiTenantDiagnosticSettings. Specifies the settings for a + * particular metric. + */ +public class MetricSettings { + /** + * the timegrain of the metric in ISO8601 format. + */ + @JsonProperty(value = "timeGrain", required = true) + private Period timeGrain; + + /** + * a value indicating whether this timegrain is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the retention policy for this timegrain. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** + * Get the timegrain of the metric in ISO8601 format. + * + * @return the timeGrain value + */ + public Period timeGrain() { + return this.timeGrain; + } + + /** + * Set the timegrain of the metric in ISO8601 format. + * + * @param timeGrain the timeGrain value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withTimeGrain(Period timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get a value indicating whether this timegrain is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether this timegrain is enabled. + * + * @param enabled the enabled value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retention policy for this timegrain. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for this timegrain. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the MetricSettings object itself. + */ + public MetricSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/RetentionPolicy.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/RetentionPolicy.java new file mode 100644 index 0000000000000..2e0c63dc3c51f --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/RetentionPolicy.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the retention policy for the log. + */ +public class RetentionPolicy { + /** + * a value indicating whether the retention policy is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the number of days for the retention in days. A value of 0 will retain + * the events indefinitely. + */ + @JsonProperty(value = "days", required = true) + private int days; + + /** + * Get a value indicating whether the retention policy is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether the retention policy is enabled. + * + * @param enabled the enabled value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @return the days value + */ + public int days() { + return this.days; + } + + /** + * Set the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @param days the days value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withDays(int days) { + this.days = days; + return this; + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettings.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettings.java new file mode 100644 index 0000000000000..bad4bc03453ae --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettings.java @@ -0,0 +1,39 @@ +/** + * 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.v2015_07_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2015_07_01.implementation.ServiceDiagnosticSettingsResourceInner; +import com.microsoft.azure.management.monitor.v2015_07_01.implementation.ServiceDiagnosticSettingsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceDiagnosticSettings. + */ +public interface ServiceDiagnosticSettings extends HasInner { + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri); + + /** + * Create or update new diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters); + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettingsResource.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettingsResource.java new file mode 100644 index 0000000000000..330a3cd17321b --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/ServiceDiagnosticSettingsResource.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2015_07_01.implementation.MonitorManager; +import com.microsoft.azure.management.monitor.v2015_07_01.implementation.ServiceDiagnosticSettingsResourceInner; +import java.util.List; +import java.util.Map; + +/** + * Type representing ServiceDiagnosticSettingsResource. + */ +public interface ServiceDiagnosticSettingsResource extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the logs value. + */ + List logs(); + + /** + * @return the metrics value. + */ + List metrics(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serviceBusRuleId value. + */ + String serviceBusRuleId(); + + /** + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the workspaceId value. + */ + String workspaceId(); + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/IdParsingUtils.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..92694fd512379 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2015_07_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorClientImpl.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorClientImpl.java new file mode 100644 index 0000000000000..9bea3c8c85da0 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorClientImpl.java @@ -0,0 +1,173 @@ +/** + * 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.v2015_07_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorClientImpl class. + */ +public class MonitorClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ServiceDiagnosticSettingsInner object to access its operations. + */ + private ServiceDiagnosticSettingsInner serviceDiagnosticSettings; + + /** + * Gets the ServiceDiagnosticSettingsInner object to access its operations. + * @return the ServiceDiagnosticSettingsInner object. + */ + public ServiceDiagnosticSettingsInner serviceDiagnosticSettings() { + return this.serviceDiagnosticSettings; + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-07-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.serviceDiagnosticSettings = new ServiceDiagnosticSettingsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorClient", "2015-07-01"); + } +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorManager.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorManager.java new file mode 100644 index 0000000000000..8cc090d069a4f --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/MonitorManager.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.v2015_07_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2015_07_01.ServiceDiagnosticSettings; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private ServiceDiagnosticSettings serviceDiagnosticSettings; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient) { + return new MonitorManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage ServiceDiagnosticSettings. + */ + public ServiceDiagnosticSettings serviceDiagnosticSettings() { + if (this.serviceDiagnosticSettings == null) { + this.serviceDiagnosticSettings = new ServiceDiagnosticSettingsImpl(this); + } + return this.serviceDiagnosticSettings; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials) { + return MonitorManager.authenticate(buildRestClient(credentials)); + } + } + private MonitorManager(RestClient restClient) { + super( + restClient, + null, + new MonitorClientImpl(restClient)); + } +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsImpl.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsImpl.java new file mode 100644 index 0000000000000..3fc19b565e1d4 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.monitor.v2015_07_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2015_07_01.ServiceDiagnosticSettings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2015_07_01.ServiceDiagnosticSettingsResource; + +class ServiceDiagnosticSettingsImpl extends WrapperImpl implements ServiceDiagnosticSettings { + private final MonitorManager manager; + + ServiceDiagnosticSettingsImpl(MonitorManager manager) { + super(manager.inner().serviceDiagnosticSettings()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceUri) { + ServiceDiagnosticSettingsInner client = this.inner(); + return client.getAsync(resourceUri) + .map(new Func1() { + @Override + public ServiceDiagnosticSettingsResource call(ServiceDiagnosticSettingsResourceInner inner) { + return new ServiceDiagnosticSettingsResourceImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters) { + ServiceDiagnosticSettingsInner client = this.inner(); + return client.createOrUpdateAsync(resourceUri, parameters) + .map(new Func1() { + @Override + public ServiceDiagnosticSettingsResource call(ServiceDiagnosticSettingsResourceInner inner) { + return new ServiceDiagnosticSettingsResourceImpl(inner, manager()); + } + }); + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsInner.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsInner.java new file mode 100644 index 0000000000000..0a159ca01765e --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsInner.java @@ -0,0 +1,228 @@ +/** + * 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.v2015_07_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.v2015_07_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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 ServiceDiagnosticSettings. + */ +public class ServiceDiagnosticSettingsInner { + /** The Retrofit service to perform REST calls. */ + private ServiceDiagnosticSettingsService service; + /** The service client containing this operation class. */ + private MonitorClientImpl client; + + /** + * Initializes an instance of ServiceDiagnosticSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceDiagnosticSettingsInner(Retrofit retrofit, MonitorClientImpl client) { + this.service = retrofit.create(ServiceDiagnosticSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceDiagnosticSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceDiagnosticSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2015_07_01.ServiceDiagnosticSettings get" }) + @GET("{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") + Observable> get(@Path("resourceUri") String resourceUri, @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.v2015_07_01.ServiceDiagnosticSettings createOrUpdate" }) + @PUT("{resourceUri}/providers/microsoft.insights/diagnosticSettings/service") + Observable> createOrUpdate(@Path("resourceUri") String resourceUri, @Query("api-version") String apiVersion, @Body ServiceDiagnosticSettingsResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @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 ServiceDiagnosticSettingsResourceInner object if successful. + */ + public ServiceDiagnosticSettingsResourceInner get(String resourceUri) { + return getWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceDiagnosticSettingsResourceInner object + */ + public Observable getAsync(String resourceUri) { + return getWithServiceResponseAsync(resourceUri).map(new Func1, ServiceDiagnosticSettingsResourceInner>() { + @Override + public ServiceDiagnosticSettingsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceDiagnosticSettingsResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update new diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ServiceDiagnosticSettingsResourceInner object if successful. + */ + public ServiceDiagnosticSettingsResourceInner createOrUpdate(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceUri, parameters).toBlocking().single().body(); + } + + /** + * Create or update new diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceUri, parameters), serviceCallback); + } + + /** + * Create or update new diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceDiagnosticSettingsResourceInner object + */ + public Observable createOrUpdateAsync(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceUri, parameters).map(new Func1, ServiceDiagnosticSettingsResourceInner>() { + @Override + public ServiceDiagnosticSettingsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update new diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceDiagnosticSettingsResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceUri, ServiceDiagnosticSettingsResourceInner parameters) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceUri, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceImpl.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceImpl.java new file mode 100644 index 0000000000000..22d1c8d9941a1 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceImpl.java @@ -0,0 +1,80 @@ +/** + * 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.v2015_07_01.implementation; + +import com.microsoft.azure.management.monitor.v2015_07_01.ServiceDiagnosticSettingsResource; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.monitor.v2015_07_01.LogSettings; +import com.microsoft.azure.management.monitor.v2015_07_01.MetricSettings; +import java.util.Map; + +class ServiceDiagnosticSettingsResourceImpl extends WrapperImpl implements ServiceDiagnosticSettingsResource { + private final MonitorManager manager; + ServiceDiagnosticSettingsResourceImpl(ServiceDiagnosticSettingsResourceInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public List logs() { + return this.inner().logs(); + } + + @Override + public List metrics() { + return this.inner().metrics(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String serviceBusRuleId() { + return this.inner().serviceBusRuleId(); + } + + @Override + public String storageAccountId() { + return this.inner().storageAccountId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String workspaceId() { + return this.inner().workspaceId(); + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceInner.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceInner.java new file mode 100644 index 0000000000000..effaedba93336 --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/ServiceDiagnosticSettingsResourceInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2015_07_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2015_07_01.MetricSettings; +import com.microsoft.azure.management.monitor.v2015_07_01.LogSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Description of a service diagnostic setting. + */ +@JsonFlatten +public class ServiceDiagnosticSettingsResourceInner extends Resource { + /** + * The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming Diagnostic Logs. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * the list of metric settings. + */ + @JsonProperty(value = "properties.metrics") + private List metrics; + + /** + * the list of logs settings. + */ + @JsonProperty(value = "properties.logs") + private List logs; + + /** + * The workspace ID (resource ID of a Log Analytics workspace) for a Log + * Analytics workspace to which you would like to send Diagnostic Logs. + * Example: + * /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + */ + @JsonProperty(value = "properties.workspaceId") + private String workspaceId; + + /** + * Get the resource ID of the storage account to which you would like to send Diagnostic Logs. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource ID of the storage account to which you would like to send Diagnostic Logs. + * + * @param storageAccountId the storageAccountId value to set + * @return the ServiceDiagnosticSettingsResourceInner object itself. + */ + public ServiceDiagnosticSettingsResourceInner withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the ServiceDiagnosticSettingsResourceInner object itself. + */ + public ServiceDiagnosticSettingsResourceInner withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get the list of metric settings. + * + * @return the metrics value + */ + public List metrics() { + return this.metrics; + } + + /** + * Set the list of metric settings. + * + * @param metrics the metrics value to set + * @return the ServiceDiagnosticSettingsResourceInner object itself. + */ + public ServiceDiagnosticSettingsResourceInner withMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + /** + * Get the list of logs settings. + * + * @return the logs value + */ + public List logs() { + return this.logs; + } + + /** + * Set the list of logs settings. + * + * @param logs the logs value to set + * @return the ServiceDiagnosticSettingsResourceInner object itself. + */ + public ServiceDiagnosticSettingsResourceInner withLogs(List logs) { + this.logs = logs; + return this; + } + + /** + * Get the workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2. + * + * @param workspaceId the workspaceId value to set + * @return the ServiceDiagnosticSettingsResourceInner object itself. + */ + public ServiceDiagnosticSettingsResourceInner withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + +} diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/package-info.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/package-info.java new file mode 100644 index 0000000000000..4285898ce416d --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2015_07_01.implementation; diff --git a/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/package-info.java b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/package-info.java new file mode 100644 index 0000000000000..29e8fe5cbda7e --- /dev/null +++ b/monitor/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/monitor/v2015_07_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2015_07_01; diff --git a/monitor/resource-manager/v2016_03_01/pom.xml b/monitor/resource-manager/v2016_03_01/pom.xml new file mode 100644 index 0000000000000..2e49b3bdcc3d8 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2016_03_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AggregationType.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AggregationType.java new file mode 100644 index 0000000000000..8ec6c89a099b3 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AggregationType.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for AggregationType. + */ +public enum AggregationType { + /** Enum value None. */ + NONE("None"), + + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"); + + /** The actual serialized value for a AggregationType instance. */ + private String value; + + AggregationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AggregationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AggregationType object, or null if unable to parse. + */ + @JsonCreator + public static AggregationType fromString(String value) { + AggregationType[] items = AggregationType.values(); + for (AggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleIncidents.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleIncidents.java new file mode 100644 index 0000000000000..b38d95701fc21 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleIncidents.java @@ -0,0 +1,40 @@ +/** + * 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.v2016_03_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.AlertRuleIncidentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AlertRuleIncidents. + */ +public interface AlertRuleIncidents extends HasInner { + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String ruleName, String incidentName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByAlertRuleAsync(String resourceGroupName, String ruleName); + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResource.java new file mode 100644 index 0000000000000..fd55ef9e519ff --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResource.java @@ -0,0 +1,184 @@ +/** + * 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.v2016_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MonitorManager; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.AlertRuleResourceInner; + +/** + * Type representing AlertRuleResource. + */ +public interface AlertRuleResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the actions value. + */ + List actions(); + + /** + * @return the alertRuleResourceName value. + */ + String alertRuleResourceName(); + + /** + * @return the condition value. + */ + RuleCondition condition(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the isEnabled value. + */ + boolean isEnabled(); + + /** + * @return the lastUpdatedTime value. + */ + DateTime lastUpdatedTime(); + + /** + * The entirety of the AlertRuleResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithAlertRuleResourceName, DefinitionStages.WithCondition, DefinitionStages.WithIsEnabled, DefinitionStages.WithCreate { + } + + /** + * Grouping of AlertRuleResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a AlertRuleResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the AlertRuleResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the alertruleresource definition allowing to specify AlertRuleResourceName. + */ + interface WithAlertRuleResourceName { + /** + * Specifies alertRuleResourceName. + * @param alertRuleResourceName the name of the alert rule + * @return the next definition stage +*/ + WithCondition withAlertRuleResourceName(String alertRuleResourceName); + } + + /** + * The stage of the alertruleresource definition allowing to specify Condition. + */ + interface WithCondition { + /** + * Specifies condition. + * @param condition the condition that results in the alert rule being activated + * @return the next definition stage +*/ + WithIsEnabled withCondition(RuleCondition condition); + } + + /** + * The stage of the alertruleresource definition allowing to specify IsEnabled. + */ + interface WithIsEnabled { + /** + * Specifies isEnabled. + * @param isEnabled the flag that indicates whether the alert rule is enabled + * @return the next definition stage +*/ + WithCreate withIsEnabled(boolean isEnabled); + } + + /** + * The stage of the alertruleresource definition allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved + * @return the next definition stage + */ + WithCreate withActions(List actions); + } + + /** + * The stage of the alertruleresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description the description of the alert rule that will be included in the alert email + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithActions, DefinitionStages.WithDescription { + } + } + /** + * The template for a AlertRuleResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithActions, UpdateStages.WithDescription { + } + + /** + * Grouping of AlertRuleResource update stages. + */ + interface UpdateStages { + /** + * The stage of the alertruleresource update allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved + * @return the next update stage + */ + Update withActions(List actions); + } + + /** + * The stage of the alertruleresource update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description the description of the alert rule that will be included in the alert email + * @return the next update stage + */ + Update withDescription(String description); + } + + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResourcePatch.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResourcePatch.java new file mode 100644 index 0000000000000..19a677bf64e1f --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRuleResourcePatch.java @@ -0,0 +1,195 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The alert rule object for patch operations. + */ +@JsonFlatten +public class AlertRuleResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String name; + + /** + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /** + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition", required = true) + private RuleCondition condition; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the name of the alert rule. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the alert rule. + * + * @param name the name value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description of the alert rule that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition that results in the alert rule being activated. + * + * @return the condition value + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition that results in the alert rule being activated. + * + * @param condition the condition value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRules.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRules.java new file mode 100644 index 0000000000000..8961a3348b55b --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/AlertRules.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.AlertRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AlertRules. + */ +public interface AlertRules extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ConditionOperator.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ConditionOperator.java new file mode 100644 index 0000000000000..f3e1fe4c544c1 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ConditionOperator.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ConditionOperator. + */ +public enum ConditionOperator { + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"); + + /** The actual serialized value for a ConditionOperator instance. */ + private String value; + + ConditionOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ConditionOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed ConditionOperator object, or null if unable to parse. + */ + @JsonCreator + public static ConditionOperator fromString(String value) { + ConditionOperator[] items = ConditionOperator.values(); + for (ConditionOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponse.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponse.java new file mode 100644 index 0000000000000..1de7f1247ad60 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponseException.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponseException.java new file mode 100644 index 0000000000000..b70db4dcba597 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Incident.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Incident.java new file mode 100644 index 0000000000000..fb80580c882ec --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Incident.java @@ -0,0 +1,46 @@ +/** + * 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.v2016_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.IncidentInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MonitorManager; +import org.joda.time.DateTime; + +/** + * Type representing Incident. + */ +public interface Incident extends HasInner, HasManager { + /** + * @return the activatedTime value. + */ + DateTime activatedTime(); + + /** + * @return the isActive value. + */ + Boolean isActive(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resolvedTime value. + */ + DateTime resolvedTime(); + + /** + * @return the ruleName value. + */ + String ruleName(); + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocalizableString.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocalizableString.java new file mode 100644 index 0000000000000..b2895db0a39fa --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocalizableString.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The localizable string class. + */ +public class LocalizableString { + /** + * the invariant value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * the locale specific value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the invariant value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the invariant value. + * + * @param value the value value to set + * @return the LocalizableString object itself. + */ + public LocalizableString withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the locale specific value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the locale specific value. + * + * @param localizedValue the localizedValue value to set + * @return the LocalizableString object itself. + */ + public LocalizableString withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocationThresholdRuleCondition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocationThresholdRuleCondition.java new file mode 100644 index 0000000000000..84ffcffa69f81 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LocationThresholdRuleCondition.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule condition based on a certain number of locations failing. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition") +public class LocationThresholdRuleCondition extends RuleCondition { + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * the number of locations that must fail to activate the alert. + */ + @JsonProperty(value = "failedLocationCount", required = true) + private int failedLocationCount; + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the number of locations that must fail to activate the alert. + * + * @return the failedLocationCount value + */ + public int failedLocationCount() { + return this.failedLocationCount; + } + + /** + * Set the number of locations that must fail to activate the alert. + * + * @param failedLocationCount the failedLocationCount value to set + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withFailedLocationCount(int failedLocationCount) { + this.failedLocationCount = failedLocationCount; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResource.java new file mode 100644 index 0000000000000..bc02f2ce5fdd4 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResource.java @@ -0,0 +1,232 @@ +/** + * 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.v2016_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.LogProfileResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MonitorManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing LogProfileResource. + */ +public interface LogProfileResource extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the categories value. + */ + List categories(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the locations value. + */ + List locations(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionPolicy value. + */ + RetentionPolicy retentionPolicy(); + + /** + * @return the serviceBusRuleId value. + */ + String serviceBusRuleId(); + + /** + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LogProfileResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCategories, DefinitionStages.WithLocation, DefinitionStages.WithLocations, DefinitionStages.WithRetentionPolicy, DefinitionStages.WithCreate { + } + + /** + * Grouping of LogProfileResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LogProfileResource definition. + */ + interface Blank extends WithCategories { + } + + /** + * The stage of the logprofileresource definition allowing to specify Categories. + */ + interface WithCategories { + /** + * Specifies categories. + * @param categories the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.' + * @return the next definition stage + */ + WithLocation withCategories(List categories); + } + + /** + * The stage of the logprofileresource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithLocations withLocation(String location); + } + + /** + * The stage of the logprofileresource definition allowing to specify Locations. + */ + interface WithLocations { + /** + * Specifies locations. + * @param locations List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location + * @return the next definition stage + */ + WithRetentionPolicy withLocations(List locations); + } + + /** + * The stage of the logprofileresource definition allowing to specify RetentionPolicy. + */ + interface WithRetentionPolicy { + /** + * Specifies retentionPolicy. + * @param retentionPolicy the retention policy for the events in the log + * @return the next definition stage + */ + WithCreate withRetentionPolicy(RetentionPolicy retentionPolicy); + } + + /** + * The stage of the logprofileresource definition allowing to specify ServiceBusRuleId. + */ + interface WithServiceBusRuleId { + /** + * Specifies serviceBusRuleId. + * @param serviceBusRuleId The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}' + * @return the next definition stage + */ + WithCreate withServiceBusRuleId(String serviceBusRuleId); + } + + /** + * The stage of the logprofileresource definition allowing to specify StorageAccountId. + */ + interface WithStorageAccountId { + /** + * Specifies storageAccountId. + * @param storageAccountId the resource id of the storage account to which you would like to send the Activity Log + * @return the next definition stage + */ + WithCreate withStorageAccountId(String storageAccountId); + } + + /** + * The stage of the logprofileresource definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithServiceBusRuleId, DefinitionStages.WithStorageAccountId, DefinitionStages.WithTags { + } + } + /** + * The template for a LogProfileResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithServiceBusRuleId, UpdateStages.WithStorageAccountId, UpdateStages.WithTags { + } + + /** + * Grouping of LogProfileResource update stages. + */ + interface UpdateStages { + /** + * The stage of the logprofileresource update allowing to specify ServiceBusRuleId. + */ + interface WithServiceBusRuleId { + /** + * Specifies serviceBusRuleId. + * @param serviceBusRuleId The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}' + * @return the next update stage + */ + Update withServiceBusRuleId(String serviceBusRuleId); + } + + /** + * The stage of the logprofileresource update allowing to specify StorageAccountId. + */ + interface WithStorageAccountId { + /** + * Specifies storageAccountId. + * @param storageAccountId the resource id of the storage account to which you would like to send the Activity Log + * @return the next update stage + */ + Update withStorageAccountId(String storageAccountId); + } + + /** + * The stage of the logprofileresource update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResourcePatch.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResourcePatch.java new file mode 100644 index 0000000000000..f097592583c47 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfileResourcePatch.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The log profile resource for patch operations. + */ +@JsonFlatten +public class LogProfileResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming the Activity Log. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * List of regions for which Activity Log events should be stored or + * streamed. It is a comma separated list of valid ARM locations including + * the 'global' location. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or + * 'Action.'. + */ + @JsonProperty(value = "properties.categories", required = true) + private List categories; + + /** + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the resource id of the storage account to which you would like to send the Activity Log. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource id of the storage account to which you would like to send the Activity Log. + * + * @param storageAccountId the storageAccountId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @param locations the locations value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retention policy for the events in the log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfiles.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfiles.java new file mode 100644 index 0000000000000..115404aa91d29 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/LogProfiles.java @@ -0,0 +1,40 @@ +/** + * 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.v2016_03_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.LogProfilesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LogProfiles. + */ +public interface LogProfiles extends SupportsCreating, SupportsListing, HasInner { + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String logProfileName); + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String logProfileName); + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventAggregationCondition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventAggregationCondition.java new file mode 100644 index 0000000000000..ba81b4f8152d7 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventAggregationCondition.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * How the data that is collected should be combined over time. + */ +public class ManagementEventAggregationCondition { + /** + * the condition operator. Possible values include: 'GreaterThan', + * 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + */ + @JsonProperty(value = "operator") + private ConditionOperator operator; + + /** + * The threshold value that activates the alert. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * Get the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @return the operator value + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the condition operator. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @param operator the operator value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold value that activates the alert. + * + * @return the threshold value + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventRuleCondition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventRuleCondition.java new file mode 100644 index 0000000000000..91a08d6ad5610 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ManagementEventRuleCondition.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A management event rule condition. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition") +public class ManagementEventRuleCondition extends RuleCondition { + /** + * How the data that is collected should be combined over time and when the + * alert is activated. Note that for management event alerts aggregation is + * optional – if it is not provided then any event will cause the alert to + * activate. + */ + @JsonProperty(value = "aggregation") + private ManagementEventAggregationCondition aggregation; + + /** + * Get how the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + * + * @return the aggregation value + */ + public ManagementEventAggregationCondition aggregation() { + return this.aggregation; + } + + /** + * Set how the data that is collected should be combined over time and when the alert is activated. Note that for management event alerts aggregation is optional – if it is not provided then any event will cause the alert to activate. + * + * @param aggregation the aggregation value to set + * @return the ManagementEventRuleCondition object itself. + */ + public ManagementEventRuleCondition withAggregation(ManagementEventAggregationCondition aggregation) { + this.aggregation = aggregation; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricAvailability.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricAvailability.java new file mode 100644 index 0000000000000..dc4e1af91727a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricAvailability.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric availability specifies the time grain (aggregation interval or + * frequency) and the retention period for that time grain. + */ +public class MetricAvailability { + /** + * the time grain specifies the aggregation interval for the metric. + * Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "timeGrain") + private Period timeGrain; + + /** + * the retention period for the metric at the specified timegrain. + * Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "retention") + private Period retention; + + /** + * Get the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @return the timeGrain value + */ + public Period timeGrain() { + return this.timeGrain; + } + + /** + * Set the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @param timeGrain the timeGrain value to set + * @return the MetricAvailability object itself. + */ + public MetricAvailability withTimeGrain(Period timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @return the retention value + */ + public Period retention() { + return this.retention; + } + + /** + * Set the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + * + * @param retention the retention value to set + * @return the MetricAvailability object itself. + */ + public MetricAvailability withRetention(Period retention) { + this.retention = retention; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinition.java new file mode 100644 index 0000000000000..ac9d15b880914 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinition.java @@ -0,0 +1,51 @@ +/** + * 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.v2016_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MonitorManager; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MetricDefinitionInner; +import java.util.List; + +/** + * Type representing MetricDefinition. + */ +public interface MetricDefinition extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + LocalizableString name(); + + /** + * @return the primaryAggregationType value. + */ + AggregationType primaryAggregationType(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the unit value. + */ + Unit unit(); + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinitions.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinitions.java new file mode 100644 index 0000000000000..ecfb239bba04d --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/MetricDefinitions.java @@ -0,0 +1,28 @@ +/** + * 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.v2016_03_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2016_03_01.implementation.MetricDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MetricDefinitions. + */ +public interface MetricDefinitions extends HasInner { + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceUri); + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RetentionPolicy.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RetentionPolicy.java new file mode 100644 index 0000000000000..35f1713648f33 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RetentionPolicy.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the retention policy for the log. + */ +public class RetentionPolicy { + /** + * a value indicating whether the retention policy is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * the number of days for the retention in days. A value of 0 will retain + * the events indefinitely. + */ + @JsonProperty(value = "days", required = true) + private int days; + + /** + * Get a value indicating whether the retention policy is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set a value indicating whether the retention policy is enabled. + * + * @param enabled the enabled value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @return the days value + */ + public int days() { + return this.days; + } + + /** + * Set the number of days for the retention in days. A value of 0 will retain the events indefinitely. + * + * @param days the days value to set + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withDays(int days) { + this.days = days; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleAction.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleAction.java new file mode 100644 index 0000000000000..ab36f6f24da6f --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleAction.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleAction") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", value = RuleEmailAction.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", value = RuleWebhookAction.class) +}) +public class RuleAction { +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleCondition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleCondition.java new file mode 100644 index 0000000000000..b3ea69d4bec6e --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleCondition.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The condition that results in the alert rule being activated. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleCondition") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", value = ThresholdRuleCondition.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", value = LocationThresholdRuleCondition.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition", value = ManagementEventRuleCondition.class) +}) +public class RuleCondition { + /** + * the resource from which the rule collects its data. For this type + * dataSource will always be of type RuleMetricDataSource. + */ + @JsonProperty(value = "dataSource") + private RuleDataSource dataSource; + + /** + * Get the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + * + * @return the dataSource value + */ + public RuleDataSource dataSource() { + return this.dataSource; + } + + /** + * Set the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. + * + * @param dataSource the dataSource value to set + * @return the RuleCondition object itself. + */ + public RuleCondition withDataSource(RuleDataSource dataSource) { + this.dataSource = dataSource; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleDataSource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleDataSource.java new file mode 100644 index 0000000000000..3ae665e7cee9a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleDataSource.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The resource from which the rule collects its data. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("RuleDataSource") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", value = RuleMetricDataSource.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource", value = RuleManagementEventDataSource.class) +}) +public class RuleDataSource { + /** + * the resource identifier of the resource the rule monitors. **NOTE**: + * this property cannot be updated for an existing rule. + */ + @JsonProperty(value = "resourceUri") + private String resourceUri; + + /** + * Get the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Set the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an existing rule. + * + * @param resourceUri the resourceUri value to set + * @return the RuleDataSource object itself. + */ + public RuleDataSource withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleEmailAction.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleEmailAction.java new file mode 100644 index 0000000000000..04eec7e95eaa9 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleEmailAction.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the action to send email when the rule condition is evaluated. The + * discriminator is always RuleEmailAction in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleEmailAction") +public class RuleEmailAction extends RuleAction { + /** + * Whether the administrators (service and co-administrators) of the + * service should be notified when the alert is activated. + */ + @JsonProperty(value = "sendToServiceOwners") + private Boolean sendToServiceOwners; + + /** + * the list of administrator's custom email addresses to notify of the + * activation of the alert. + */ + @JsonProperty(value = "customEmails") + private List customEmails; + + /** + * Get whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + * + * @return the sendToServiceOwners value + */ + public Boolean sendToServiceOwners() { + return this.sendToServiceOwners; + } + + /** + * Set whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. + * + * @param sendToServiceOwners the sendToServiceOwners value to set + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withSendToServiceOwners(Boolean sendToServiceOwners) { + this.sendToServiceOwners = sendToServiceOwners; + return this; + } + + /** + * Get the list of administrator's custom email addresses to notify of the activation of the alert. + * + * @return the customEmails value + */ + public List customEmails() { + return this.customEmails; + } + + /** + * Set the list of administrator's custom email addresses to notify of the activation of the alert. + * + * @param customEmails the customEmails value to set + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withCustomEmails(List customEmails) { + this.customEmails = customEmails; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventClaimsDataSource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventClaimsDataSource.java new file mode 100644 index 0000000000000..807c9e19bafa2 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventClaimsDataSource.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The claims for a rule management event data source. + */ +public class RuleManagementEventClaimsDataSource { + /** + * the email address. + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /** + * Get the email address. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address. + * + * @param emailAddress the emailAddress value to set + * @return the RuleManagementEventClaimsDataSource object itself. + */ + public RuleManagementEventClaimsDataSource withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventDataSource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventDataSource.java new file mode 100644 index 0000000000000..3e74fcf0c6554 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleManagementEventDataSource.java @@ -0,0 +1,258 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule management event data source. The discriminator fields is always + * RuleManagementEventDataSource in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource") +public class RuleManagementEventDataSource extends RuleDataSource { + /** + * the event name. + */ + @JsonProperty(value = "eventName") + private String eventName; + + /** + * the event source. + */ + @JsonProperty(value = "eventSource") + private String eventSource; + + /** + * the level. + */ + @JsonProperty(value = "level") + private String level; + + /** + * The name of the operation that should be checked for. If no name is + * provided, any operation will match. + */ + @JsonProperty(value = "operationName") + private String operationName; + + /** + * the resource group name. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * the resource provider name. + */ + @JsonProperty(value = "resourceProviderName") + private String resourceProviderName; + + /** + * The status of the operation that should be checked for. If no status is + * provided, any status will match. + */ + @JsonProperty(value = "status") + private String status; + + /** + * the substatus. + */ + @JsonProperty(value = "subStatus") + private String subStatus; + + /** + * the claims. + */ + @JsonProperty(value = "claims") + private RuleManagementEventClaimsDataSource claims; + + /** + * Get the event name. + * + * @return the eventName value + */ + public String eventName() { + return this.eventName; + } + + /** + * Set the event name. + * + * @param eventName the eventName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the event source. + * + * @return the eventSource value + */ + public String eventSource() { + return this.eventSource; + } + + /** + * Set the event source. + * + * @param eventSource the eventSource value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventSource(String eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the level. + * + * @return the level value + */ + public String level() { + return this.level; + } + + /** + * Set the level. + * + * @param level the level value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withLevel(String level) { + this.level = level; + return this; + } + + /** + * Get the name of the operation that should be checked for. If no name is provided, any operation will match. + * + * @return the operationName value + */ + public String operationName() { + return this.operationName; + } + + /** + * Set the name of the operation that should be checked for. If no name is provided, any operation will match. + * + * @param operationName the operationName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withOperationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Get the resource group name. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resource group name. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the resource provider name. + * + * @return the resourceProviderName value + */ + public String resourceProviderName() { + return this.resourceProviderName; + } + + /** + * Set the resource provider name. + * + * @param resourceProviderName the resourceProviderName value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceProviderName(String resourceProviderName) { + this.resourceProviderName = resourceProviderName; + return this; + } + + /** + * Get the status of the operation that should be checked for. If no status is provided, any status will match. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the operation that should be checked for. If no status is provided, any status will match. + * + * @param status the status value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the substatus. + * + * @return the subStatus value + */ + public String subStatus() { + return this.subStatus; + } + + /** + * Set the substatus. + * + * @param subStatus the subStatus value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withSubStatus(String subStatus) { + this.subStatus = subStatus; + return this; + } + + /** + * Get the claims. + * + * @return the claims value + */ + public RuleManagementEventClaimsDataSource claims() { + return this.claims; + } + + /** + * Set the claims. + * + * @param claims the claims value to set + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withClaims(RuleManagementEventClaimsDataSource claims) { + this.claims = claims; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleMetricDataSource.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleMetricDataSource.java new file mode 100644 index 0000000000000..3814c965e9400 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleMetricDataSource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule metric data source. The discriminator value is always + * RuleMetricDataSource in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource") +public class RuleMetricDataSource extends RuleDataSource { + /** + * the name of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricName") + private String metricName; + + /** + * Get the name of the metric that defines what the rule monitors. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the name of the metric that defines what the rule monitors. + * + * @param metricName the metricName value to set + * @return the RuleMetricDataSource object itself. + */ + public RuleMetricDataSource withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleWebhookAction.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleWebhookAction.java new file mode 100644 index 0000000000000..16349edffe28f --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/RuleWebhookAction.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the action to post to service when the rule condition is + * evaluated. The discriminator is always RuleWebhookAction in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleWebhookAction") +public class RuleWebhookAction extends RuleAction { + /** + * the service uri to Post the notification when the alert activates or + * resolves. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * the dictionary of custom properties to include with the post operation. + * These data are appended to the webhook payload. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Get the service uri to Post the notification when the alert activates or resolves. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the service uri to Post the notification when the alert activates or resolves. + * + * @param serviceUri the serviceUri value to set + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @param properties the properties value to set + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ThresholdRuleCondition.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ThresholdRuleCondition.java new file mode 100644 index 0000000000000..03e9c5523a9c0 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/ThresholdRuleCondition.java @@ -0,0 +1,133 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import org.joda.time.Period; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule condition based on a metric crossing a threshold. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition") +public class ThresholdRuleCondition extends RuleCondition { + /** + * the operator used to compare the data and the threshold. Possible values + * include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual'. + */ + @JsonProperty(value = "operator", required = true) + private ConditionOperator operator; + + /** + * the threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. If specified then it must be + * between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Period windowSize; + + /** + * the time aggregation operator. How the data that are collected should be + * combined over time. The default value is the PrimaryAggregationType of + * the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', + * 'Total', 'Last'. + */ + @JsonProperty(value = "timeAggregation") + private TimeAggregationOperator timeAggregation; + + /** + * Get the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @return the operator value + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the operator used to compare the data and the threshold. Possible values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'. + * + * @param operator the operator value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold value that activates the alert. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last'. + * + * @return the timeAggregation value + */ + public TimeAggregationOperator timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric. Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', 'Last'. + * + * @param timeAggregation the timeAggregation value to set + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withTimeAggregation(TimeAggregationOperator timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/TimeAggregationOperator.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/TimeAggregationOperator.java new file mode 100644 index 0000000000000..f1f3f636194e0 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/TimeAggregationOperator.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for TimeAggregationOperator. + */ +public enum TimeAggregationOperator { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"), + + /** Enum value Last. */ + LAST("Last"); + + /** The actual serialized value for a TimeAggregationOperator instance. */ + private String value; + + TimeAggregationOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TimeAggregationOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed TimeAggregationOperator object, or null if unable to parse. + */ + @JsonCreator + public static TimeAggregationOperator fromString(String value) { + TimeAggregationOperator[] items = TimeAggregationOperator.values(); + for (TimeAggregationOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Unit.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Unit.java new file mode 100644 index 0000000000000..f2efab7fe1aa5 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/Unit.java @@ -0,0 +1,68 @@ +/** + * 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.v2016_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Unit. + */ +public enum Unit { + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Bytes. */ + BYTES("Bytes"), + + /** Enum value Seconds. */ + SECONDS("Seconds"), + + /** Enum value CountPerSecond. */ + COUNT_PER_SECOND("CountPerSecond"), + + /** Enum value BytesPerSecond. */ + BYTES_PER_SECOND("BytesPerSecond"), + + /** Enum value Percent. */ + PERCENT("Percent"), + + /** Enum value MilliSeconds. */ + MILLI_SECONDS("MilliSeconds"); + + /** The actual serialized value for a Unit instance. */ + private String value; + + Unit(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Unit instance. + * + * @param value the serialized value to parse. + * @return the parsed Unit object, or null if unable to parse. + */ + @JsonCreator + public static Unit fromString(String value) { + Unit[] items = Unit.values(); + for (Unit item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsImpl.java new file mode 100644 index 0000000000000..e8f4c1eb9015b --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleIncidents; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.Incident; + +class AlertRuleIncidentsImpl extends WrapperImpl implements AlertRuleIncidents { + private final MonitorManager manager; + + AlertRuleIncidentsImpl(MonitorManager manager) { + super(manager.inner().alertRuleIncidents()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + private IncidentImpl wrapModel(IncidentInner inner) { + return new IncidentImpl(inner, manager()); + } + + @Override + public Observable listByAlertRuleAsync(String resourceGroupName, String ruleName) { + AlertRuleIncidentsInner client = this.inner(); + return client.listByAlertRuleAsync(resourceGroupName, ruleName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Incident call(IncidentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String ruleName, String incidentName) { + AlertRuleIncidentsInner client = this.inner(); + return client.getAsync(resourceGroupName, ruleName, incidentName) + .map(new Func1() { + @Override + public Incident call(IncidentInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsInner.java new file mode 100644 index 0000000000000..d9a2cbcbf3df7 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleIncidentsInner.java @@ -0,0 +1,250 @@ +/** + * 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.v2016_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.v2016_03_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AlertRuleIncidents. + */ +public class AlertRuleIncidentsInner { + /** The Retrofit service to perform REST calls. */ + private AlertRuleIncidentsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of AlertRuleIncidentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AlertRuleIncidentsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(AlertRuleIncidentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AlertRuleIncidents to be + * used by Retrofit to perform actually REST calls. + */ + interface AlertRuleIncidentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleIncidents get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("incidentName") String incidentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleIncidents listByAlertRule" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents") + Observable> listByAlertRule(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the IncidentInner object if successful. + */ + public IncidentInner get(String resourceGroupName, String ruleName, String incidentName) { + return getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName).toBlocking().single().body(); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String ruleName, String incidentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName), serviceCallback); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IncidentInner object + */ + public Observable getAsync(String resourceGroupName, String ruleName, String incidentName) { + return getWithServiceResponseAsync(resourceGroupName, ruleName, incidentName).map(new Func1, IncidentInner>() { + @Override + public IncidentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the IncidentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String ruleName, String incidentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (incidentName == null) { + throw new IllegalArgumentException("Parameter incidentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, ruleName, incidentName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<IncidentInner> object if successful. + */ + public List listByAlertRule(String resourceGroupName, String ruleName) { + return listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAlertRuleAsync(String resourceGroupName, String ruleName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IncidentInner> object + */ + public Observable> listByAlertRuleAsync(String resourceGroupName, String ruleName) { + return listByAlertRuleWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IncidentInner> object + */ + public Observable>> listByAlertRuleWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByAlertRule(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAlertRuleDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAlertRuleDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceImpl.java new file mode 100644 index 0000000000000..7042ba6478616 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceImpl.java @@ -0,0 +1,139 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleResourcePatch; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2016_03_01.RuleCondition; +import com.microsoft.azure.management.monitor.v2016_03_01.RuleAction; +import rx.functions.Func1; + +class AlertRuleResourceImpl extends GroupableResourceCoreImpl implements AlertRuleResource, AlertRuleResource.Definition, AlertRuleResource.Update { + private AlertRuleResourcePatch updateParameter; + AlertRuleResourceImpl(String name, AlertRuleResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new AlertRuleResourcePatch(); + } + + @Override + public Observable createResourceAsync() { + AlertRulesInner client = this.manager().inner().alertRules(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public AlertRuleResourceInner call(AlertRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + AlertRulesInner client = this.manager().inner().alertRules(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public AlertRuleResourceInner call(AlertRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + AlertRulesInner client = this.manager().inner().alertRules(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new AlertRuleResourcePatch(); + } + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public String alertRuleResourceName() { + return this.inner().alertRuleResourceName(); + } + + @Override + public RuleCondition condition() { + return this.inner().condition(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public boolean isEnabled() { + return this.inner().isEnabled(); + } + + @Override + public DateTime lastUpdatedTime() { + return this.inner().lastUpdatedTime(); + } + + @Override + public AlertRuleResourceImpl withAlertRuleResourceName(String alertRuleResourceName) { + this.inner().withAlertRuleResourceName(alertRuleResourceName); + return this; + } + + @Override + public AlertRuleResourceImpl withCondition(RuleCondition condition) { + this.inner().withCondition(condition); + return this; + } + + @Override + public AlertRuleResourceImpl withIsEnabled(boolean isEnabled) { + this.inner().withIsEnabled(isEnabled); + return this; + } + + @Override + public AlertRuleResourceImpl withActions(List actions) { + if (isInCreateMode()) { + this.inner().withActions(actions); + } else { + this.updateParameter.withActions(actions); + } + return this; + } + + @Override + public AlertRuleResourceImpl withDescription(String description) { + if (isInCreateMode()) { + this.inner().withDescription(description); + } else { + this.updateParameter.withDescription(description); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceInner.java new file mode 100644 index 0000000000000..a1db57b2a0407 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRuleResourceInner.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2016_03_01.RuleCondition; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.RuleAction; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The alert rule resource. + */ +@JsonFlatten +public class AlertRuleResourceInner extends Resource { + /** + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String alertRuleResourceName; + + /** + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /** + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition", required = true) + private RuleCondition condition; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the name of the alert rule. + * + * @return the alertRuleResourceName value + */ + public String alertRuleResourceName() { + return this.alertRuleResourceName; + } + + /** + * Set the name of the alert rule. + * + * @param alertRuleResourceName the alertRuleResourceName value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withAlertRuleResourceName(String alertRuleResourceName) { + this.alertRuleResourceName = alertRuleResourceName; + return this; + } + + /** + * Get the description of the alert rule that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition that results in the alert rule being activated. + * + * @return the condition value + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition that results in the alert rule being activated. + * + * @param condition the condition value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesImpl.java new file mode 100644 index 0000000000000..95af065478529 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRules; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class AlertRulesImpl extends GroupableResourcesCoreImpl implements AlertRules { + protected AlertRulesImpl(MonitorManager manager) { + super(manager.inner().alertRules(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + AlertRulesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + AlertRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + AlertRulesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + AlertRulesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public AlertRuleResource call(AlertRuleResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + AlertRulesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + AlertRulesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public AlertRuleResource call(AlertRuleResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public AlertRuleResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected AlertRuleResourceImpl wrapModel(AlertRuleResourceInner inner) { + return new AlertRuleResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected AlertRuleResourceImpl wrapModel(String name) { + return new AlertRuleResourceImpl(name, new AlertRuleResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesInner.java new file mode 100644 index 0000000000000..24c740edde320 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/AlertRulesInner.java @@ -0,0 +1,624 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleResourcePatch; +import com.microsoft.azure.management.monitor.v2016_03_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AlertRules. + */ +public class AlertRulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private AlertRulesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of AlertRulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AlertRulesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(AlertRulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AlertRules to be + * used by Retrofit to perform actually REST calls. + */ + interface AlertRulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body AlertRuleResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body AlertRuleResourcePatch alertRulesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.AlertRules list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AlertRuleResourceInner object if successful. + */ + public AlertRuleResourceInner update(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).toBlocking().single().body(); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource), serviceCallback); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, alertRulesResource).map(new Func1, AlertRuleResourceInner>() { + @Override + public AlertRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AlertRuleResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (alertRulesResource == null) { + throw new IllegalArgumentException("Parameter alertRulesResource is required and cannot be null."); + } + Validator.validate(alertRulesResource); + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), alertRulesResource, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List the alert rules within a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the alert rules within a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the alert rules within a subscription. + * + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the alert rules within a subscription. + * + * @return the observable to the List<AlertRuleResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IdParsingUtils.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..fee1a849fbca0 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2016_03_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentImpl.java new file mode 100644 index 0000000000000..7eab9a111148b --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2016_03_01.Incident; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class IncidentImpl extends WrapperImpl implements Incident { + private final MonitorManager manager; + private String resourceGroupName; + private String ruleName; + private String incidentName; + + IncidentImpl(IncidentInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + + + @Override + public DateTime activatedTime() { + return this.inner().activatedTime(); + } + + @Override + public Boolean isActive() { + return this.inner().isActive(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime resolvedTime() { + return this.inner().resolvedTime(); + } + + @Override + public String ruleName() { + return this.inner().ruleName(); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentInner.java new file mode 100644 index 0000000000000..e201359036a5a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/IncidentInner.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert incident indicates the activation status of an alert rule. + */ +public class IncidentInner { + /** + * Incident name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Rule name that is associated with the incident. + */ + @JsonProperty(value = "ruleName", access = JsonProperty.Access.WRITE_ONLY) + private String ruleName; + + /** + * A boolean to indicate whether the incident is active or resolved. + */ + @JsonProperty(value = "isActive", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActive; + + /** + * The time at which the incident was activated in ISO8601 format. + */ + @JsonProperty(value = "activatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime activatedTime; + + /** + * The time at which the incident was resolved in ISO8601 format. If null, + * it means the incident is still active. + */ + @JsonProperty(value = "resolvedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime resolvedTime; + + /** + * Get incident name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get rule name that is associated with the incident. + * + * @return the ruleName value + */ + public String ruleName() { + return this.ruleName; + } + + /** + * Get a boolean to indicate whether the incident is active or resolved. + * + * @return the isActive value + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Get the time at which the incident was activated in ISO8601 format. + * + * @return the activatedTime value + */ + public DateTime activatedTime() { + return this.activatedTime; + } + + /** + * Get the time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + * + * @return the resolvedTime value + */ + public DateTime resolvedTime() { + return this.resolvedTime; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceImpl.java new file mode 100644 index 0000000000000..0d081fb7eeea3 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceImpl.java @@ -0,0 +1,198 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfileResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfileResourcePatch; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.RetentionPolicy; +import rx.functions.Func1; + +class LogProfileResourceImpl extends CreatableUpdatableImpl implements LogProfileResource, LogProfileResource.Definition, LogProfileResource.Update { + private String logProfileName; + private LogProfileResourcePatch updateParameter; + private final MonitorManager manager; + + LogProfileResourceImpl(String name, MonitorManager manager) { + super(name, new LogProfileResourceInner()); + this.manager = manager; + // Set resource name + this.logProfileName = name; + // + this.updateParameter = new LogProfileResourcePatch(); + } + + LogProfileResourceImpl(LogProfileResourceInner inner, MonitorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.logProfileName = inner.name(); + // set resource ancestor and positional variables + this.logProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "logprofiles"); + // set other parameters for create and update + this.updateParameter = new LogProfileResourcePatch(); + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LogProfilesInner client = this.manager().inner().logProfiles(); + return client.createOrUpdateAsync(this.logProfileName, this.inner()) + .map(new Func1() { + @Override + public LogProfileResourceInner call(LogProfileResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LogProfilesInner client = this.manager().inner().logProfiles(); + return client.updateAsync(this.logProfileName, this.updateParameter) + .map(new Func1() { + @Override + public LogProfileResourceInner call(LogProfileResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LogProfilesInner client = this.manager().inner().logProfiles(); + return client.getAsync(this.logProfileName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new LogProfileResourcePatch(); + } + + @Override + public List categories() { + return this.inner().categories(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public List locations() { + return this.inner().locations(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public RetentionPolicy retentionPolicy() { + return this.inner().retentionPolicy(); + } + + @Override + public String serviceBusRuleId() { + return this.inner().serviceBusRuleId(); + } + + @Override + public String storageAccountId() { + return this.inner().storageAccountId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public LogProfileResourceImpl withCategories(List categories) { + this.inner().withCategories(categories); + return this; + } + + @Override + public LogProfileResourceImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public LogProfileResourceImpl withLocations(List locations) { + this.inner().withLocations(locations); + return this; + } + + @Override + public LogProfileResourceImpl withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.inner().withRetentionPolicy(retentionPolicy); + return this; + } + + @Override + public LogProfileResourceImpl withServiceBusRuleId(String serviceBusRuleId) { + if (isInCreateMode()) { + this.inner().withServiceBusRuleId(serviceBusRuleId); + } else { + this.updateParameter.withServiceBusRuleId(serviceBusRuleId); + } + return this; + } + + @Override + public LogProfileResourceImpl withStorageAccountId(String storageAccountId) { + if (isInCreateMode()) { + this.inner().withStorageAccountId(storageAccountId); + } else { + this.updateParameter.withStorageAccountId(storageAccountId); + } + return this; + } + + @Override + public LogProfileResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceInner.java new file mode 100644 index 0000000000000..3b8e25cdc2455 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfileResourceInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.RetentionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The log profile resource. + */ +@JsonFlatten +public class LogProfileResourceInner extends Resource { + /** + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /** + * The service bus rule ID of the service bus namespace in which you would + * like to have Event Hubs created for streaming the Activity Log. The rule + * ID is of the format: '{service bus resource ID}/authorizationrules/{key + * name}'. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /** + * List of regions for which Activity Log events should be stored or + * streamed. It is a comma separated list of valid ARM locations including + * the 'global' location. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or + * 'Action.'. + */ + @JsonProperty(value = "properties.categories", required = true) + private List categories; + + /** + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** + * Get the resource id of the storage account to which you would like to send the Activity Log. + * + * @return the storageAccountId value + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the resource id of the storage account to which you would like to send the Activity Log. + * + * @param storageAccountId the storageAccountId value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @return the serviceBusRuleId value + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the Activity Log. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set list of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid ARM locations including the 'global' location. + * + * @param locations the locations value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retention policy for the events in the log. + * + * @return the retentionPolicy value + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesImpl.java new file mode 100644 index 0000000000000..1b1c10042a7e0 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesImpl.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. + * jkl + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfileResource; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class LogProfilesImpl extends WrapperImpl implements LogProfiles { + private PagedListConverter converter; + private final MonitorManager manager; + + LogProfilesImpl(MonitorManager manager) { + super(manager.inner().logProfiles()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(LogProfileResourceInner inner) { + return Observable.just((LogProfileResource) wrapModel(inner)); + } + }; + } + + public MonitorManager manager() { + return this.manager; + } + + @Override + public LogProfileResourceImpl define(String name) { + return wrapModel(name); + } + + private LogProfileResourceImpl wrapModel(LogProfileResourceInner inner) { + return new LogProfileResourceImpl(inner, manager()); + } + + private LogProfileResourceImpl wrapModel(String name) { + return new LogProfileResourceImpl(name, this.manager()); + } + + @Override + public Completable deleteAsync(String logProfileName) { + LogProfilesInner client = this.inner(); + return client.deleteAsync(logProfileName).toCompletable(); + } + + @Override + public Observable getAsync(String logProfileName) { + LogProfilesInner client = this.inner(); + return client.getAsync(logProfileName) + .map(new Func1() { + @Override + public LogProfileResource call(LogProfileResourceInner inner) { + return new LogProfileResourceImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + LogProfilesInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + LogProfilesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public LogProfileResource call(LogProfileResourceInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesInner.java new file mode 100644 index 0000000000000..c9d26d8043b5a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/LogProfilesInner.java @@ -0,0 +1,498 @@ +/** + * 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.v2016_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.v2016_03_01.ErrorResponseException; +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfileResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LogProfiles. + */ +public class LogProfilesInner { + /** The Retrofit service to perform REST calls. */ + private LogProfilesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of LogProfilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LogProfilesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(LogProfilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LogProfiles to be + * used by Retrofit to perform actually REST calls. + */ + interface LogProfilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles get" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> get(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> createOrUpdate(@Path("logProfileName") String logProfileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body LogProfileResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles update" }) + @PATCH("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("logProfileName") String logProfileName, @Query("api-version") String apiVersion, @Body LogProfileResourcePatch logProfilesResource, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String logProfileName) { + deleteWithServiceResponseAsync(logProfileName).toBlocking().single().body(); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String logProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(logProfileName), serviceCallback); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String logProfileName) { + return deleteWithServiceResponseAsync(logProfileName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String logProfileName) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(logProfileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner get(String logProfileName) { + return getWithServiceResponseAsync(logProfileName).toBlocking().single().body(); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String logProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(logProfileName), serviceCallback); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable getAsync(String logProfileName) { + return getWithServiceResponseAsync(logProfileName).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> getWithServiceResponseAsync(String logProfileName) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(logProfileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner createOrUpdate(String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(logProfileName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String logProfileName, LogProfileResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(logProfileName, parameters), serviceCallback); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable createOrUpdateAsync(String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(logProfileName, parameters).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String logProfileName, LogProfileResourceInner parameters) { + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(logProfileName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogProfileResourceInner object if successful. + */ + public LogProfileResourceInner update(String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithServiceResponseAsync(logProfileName, logProfilesResource).toBlocking().single().body(); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(logProfileName, logProfilesResource), serviceCallback); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable updateAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithServiceResponseAsync(logProfileName, logProfilesResource).map(new Func1, LogProfileResourceInner>() { + @Override + public LogProfileResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogProfileResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String logProfileName, LogProfileResourcePatch logProfilesResource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (logProfileName == null) { + throw new IllegalArgumentException("Parameter logProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (logProfilesResource == null) { + throw new IllegalArgumentException("Parameter logProfilesResource is required and cannot be null."); + } + Validator.validate(logProfilesResource); + return service.update(this.client.subscriptionId(), logProfileName, this.client.apiVersion(), logProfilesResource, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the log profiles. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * List the log profiles. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * List the log profiles. + * + * @return the observable to the List<LogProfileResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * List the log profiles. + * + * @return the observable to the List<LogProfileResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionImpl.java new file mode 100644 index 0000000000000..3e1d9d65a304e --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionImpl.java @@ -0,0 +1,61 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2016_03_01.MetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.MetricAvailability; +import com.microsoft.azure.management.monitor.v2016_03_01.LocalizableString; +import com.microsoft.azure.management.monitor.v2016_03_01.AggregationType; +import com.microsoft.azure.management.monitor.v2016_03_01.Unit; + +class MetricDefinitionImpl extends WrapperImpl implements MetricDefinition { + private final MonitorManager manager; + MetricDefinitionImpl(MetricDefinitionInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public LocalizableString name() { + return this.inner().name(); + } + + @Override + public AggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public Unit unit() { + return this.inner().unit(); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionInner.java new file mode 100644 index 0000000000000..a154910902f3c --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionInner.java @@ -0,0 +1,184 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2016_03_01.LocalizableString; +import com.microsoft.azure.management.monitor.v2016_03_01.Unit; +import com.microsoft.azure.management.monitor.v2016_03_01.AggregationType; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.MetricAvailability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric definition class specifies the metadata for a metric. + */ +public class MetricDefinitionInner { + /** + * the resource identifier of the resource that emitted the metric. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * the name and the display name of the metric, i.e. it is a localizable + * string. + */ + @JsonProperty(value = "name") + private LocalizableString name; + + /** + * the unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', + * 'MilliSeconds'. + */ + @JsonProperty(value = "unit") + private Unit unit; + + /** + * the primary aggregation type value defining how to use the values for + * display. Possible values include: 'None', 'Average', 'Count', 'Minimum', + * 'Maximum', 'Total'. + */ + @JsonProperty(value = "primaryAggregationType") + private AggregationType primaryAggregationType; + + /** + * the collection of what aggregation intervals are available to be + * queried. + */ + @JsonProperty(value = "metricAvailabilities") + private List metricAvailabilities; + + /** + * the resource identifier of the metric definition. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the resource identifier of the resource that emitted the metric. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource identifier of the resource that emitted the metric. + * + * @param resourceId the resourceId value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the name and the display name of the metric, i.e. it is a localizable string. + * + * @return the name value + */ + public LocalizableString name() { + return this.name; + } + + /** + * Set the name and the display name of the metric, i.e. it is a localizable string. + * + * @param name the name value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withName(LocalizableString name) { + this.name = name; + return this; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds'. + * + * @return the unit value + */ + public Unit unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', 'Percent', 'MilliSeconds'. + * + * @param unit the unit value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withUnit(Unit unit) { + this.unit = unit; + return this; + } + + /** + * Get the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @return the primaryAggregationType value + */ + public AggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Set the primary aggregation type value defining how to use the values for display. Possible values include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', 'Total'. + * + * @param primaryAggregationType the primaryAggregationType value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withPrimaryAggregationType(AggregationType primaryAggregationType) { + this.primaryAggregationType = primaryAggregationType; + return this; + } + + /** + * Get the collection of what aggregation intervals are available to be queried. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Set the collection of what aggregation intervals are available to be queried. + * + * @param metricAvailabilities the metricAvailabilities value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withMetricAvailabilities(List metricAvailabilities) { + this.metricAvailabilities = metricAvailabilities; + return this; + } + + /** + * Get the resource identifier of the metric definition. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the resource identifier of the metric definition. + * + * @param id the id value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsImpl.java new file mode 100644 index 0000000000000..7e0a4d16863be --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2016_03_01.MetricDefinitions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.monitor.v2016_03_01.MetricDefinition; + +class MetricDefinitionsImpl extends WrapperImpl implements MetricDefinitions { + private final MonitorManager manager; + + MetricDefinitionsImpl(MonitorManager manager) { + super(manager.inner().metricDefinitions()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String resourceUri) { + MetricDefinitionsInner client = this.inner(); + return client.listAsync(resourceUri) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public MetricDefinition call(MetricDefinitionInner inner) { + return new MetricDefinitionImpl(inner, manager()); + } + }); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsInner.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsInner.java new file mode 100644 index 0000000000000..001419e8533ef --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MetricDefinitionsInner.java @@ -0,0 +1,221 @@ +/** + * 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.v2016_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2016_03_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricDefinitions. + */ +public class MetricDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private MetricDefinitionsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricDefinitionsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2016_03_01.MetricDefinitions list" }) + @GET("{resourceUri}/providers/microsoft.insights/metricDefinitions") + Observable> list(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricDefinitionInner> object if successful. + */ + public List list(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listAsync(String resourceUri) { + return listWithServiceResponseAsync(resourceUri).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(resourceUri, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param filter Reduces the set of data collected by retrieving particular metric definitions from all the definitions available for the resource.<br>For example, to get just the definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.<br>Multiple metrics can be retrieved by joining together *'name eq <value>'* clauses separated by *or* logical operators.<br>**NOTE**: No other syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<MetricDefinitionInner> object if successful. + */ + public List list(String resourceUri, String filter) { + return listWithServiceResponseAsync(resourceUri, filter).toBlocking().single().body(); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param filter Reduces the set of data collected by retrieving particular metric definitions from all the definitions available for the resource.<br>For example, to get just the definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.<br>Multiple metrics can be retrieved by joining together *'name eq <value>'* clauses separated by *or* logical operators.<br>**NOTE**: No other syntax is allowed. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String resourceUri, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceUri, filter), serviceCallback); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param filter Reduces the set of data collected by retrieving particular metric definitions from all the definitions available for the resource.<br>For example, to get just the definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.<br>Multiple metrics can be retrieved by joining together *'name eq <value>'* clauses separated by *or* logical operators.<br>**NOTE**: No other syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listAsync(String resourceUri, String filter) { + return listWithServiceResponseAsync(resourceUri, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param filter Reduces the set of data collected by retrieving particular metric definitions from all the definitions available for the resource.<br>For example, to get just the definition for the 'CPU percentage' counter: $filter=name.value eq '\Processor(_Total)\% Processor Time'.<br>Multiple metrics can be retrieved by joining together *'name eq <value>'* clauses separated by *or* logical operators.<br>**NOTE**: No other syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceUri, String filter) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceUri, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManagementClientImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManagementClientImpl.java new file mode 100644 index 0000000000000..f1e8480cf7b9b --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The AlertRulesInner object to access its operations. + */ + private AlertRulesInner alertRules; + + /** + * Gets the AlertRulesInner object to access its operations. + * @return the AlertRulesInner object. + */ + public AlertRulesInner alertRules() { + return this.alertRules; + } + + /** + * The AlertRuleIncidentsInner object to access its operations. + */ + private AlertRuleIncidentsInner alertRuleIncidents; + + /** + * Gets the AlertRuleIncidentsInner object to access its operations. + * @return the AlertRuleIncidentsInner object. + */ + public AlertRuleIncidentsInner alertRuleIncidents() { + return this.alertRuleIncidents; + } + + /** + * The LogProfilesInner object to access its operations. + */ + private LogProfilesInner logProfiles; + + /** + * Gets the LogProfilesInner object to access its operations. + * @return the LogProfilesInner object. + */ + public LogProfilesInner logProfiles() { + return this.logProfiles; + } + + /** + * The MetricDefinitionsInner object to access its operations. + */ + private MetricDefinitionsInner metricDefinitions; + + /** + * Gets the MetricDefinitionsInner object to access its operations. + * @return the MetricDefinitionsInner object. + */ + public MetricDefinitionsInner metricDefinitions() { + return this.metricDefinitions; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-03-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.alertRules = new AlertRulesInner(restClient().retrofit(), this); + this.alertRuleIncidents = new AlertRuleIncidentsInner(restClient().retrofit(), this); + this.logProfiles = new LogProfilesInner(restClient().retrofit(), this); + this.metricDefinitions = new MetricDefinitionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorManagementClient", "2016-03-01"); + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManager.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManager.java new file mode 100644 index 0000000000000..b4bef35215c42 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/MonitorManager.java @@ -0,0 +1,135 @@ +/** + * 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.v2016_03_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRules; +import com.microsoft.azure.management.monitor.v2016_03_01.AlertRuleIncidents; +import com.microsoft.azure.management.monitor.v2016_03_01.LogProfiles; +import com.microsoft.azure.management.monitor.v2016_03_01.MetricDefinitions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private AlertRules alertRules; + private AlertRuleIncidents alertRuleIncidents; + private LogProfiles logProfiles; + private MetricDefinitions metricDefinitions; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage AlertRules. + */ + public AlertRules alertRules() { + if (this.alertRules == null) { + this.alertRules = new AlertRulesImpl(this); + } + return this.alertRules; + } + + /** + * @return Entry point to manage AlertRuleIncidents. + */ + public AlertRuleIncidents alertRuleIncidents() { + if (this.alertRuleIncidents == null) { + this.alertRuleIncidents = new AlertRuleIncidentsImpl(this); + } + return this.alertRuleIncidents; + } + + /** + * @return Entry point to manage LogProfiles. + */ + public LogProfiles logProfiles() { + if (this.logProfiles == null) { + this.logProfiles = new LogProfilesImpl(this); + } + return this.logProfiles; + } + + /** + * @return Entry point to manage MetricDefinitions. + */ + public MetricDefinitions metricDefinitions() { + if (this.metricDefinitions == null) { + this.metricDefinitions = new MetricDefinitionsImpl(this); + } + return this.metricDefinitions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/PageImpl.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..53be94129695a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/package-info.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/package-info.java new file mode 100644 index 0000000000000..7f9f0689b979a --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2016_03_01.implementation; diff --git a/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/package-info.java b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/package-info.java new file mode 100644 index 0000000000000..119f8d74abf69 --- /dev/null +++ b/monitor/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/monitor/v2016_03_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2016_03_01; diff --git a/monitor/resource-manager/v2017_03_01_preview/pom.xml b/monitor/resource-manager/v2017_03_01_preview/pom.xml new file mode 100644 index 0000000000000..86250bbd5fbac --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2017_03_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionGroup.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionGroup.java new file mode 100644 index 0000000000000..298fcbef1fbd3 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionGroup.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A pointer to an Azure Action Group. + */ +public class ActivityLogAlertActionGroup { + /** + * The resourceId of the action group. This cannot be null or empty. + */ + @JsonProperty(value = "actionGroupId", required = true) + private String actionGroupId; + + /** + * The dictionary of custom properties to include with the post operation. + * These data are appended to the webhook payload. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the resourceId of the action group. This cannot be null or empty. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the resourceId of the action group. This cannot be null or empty. + * + * @param actionGroupId the actionGroupId value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @param webhookProperties the webhookProperties value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionList.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionList.java new file mode 100644 index 0000000000000..2932077048aa7 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertActionList.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of activity log alert actions. + */ +public class ActivityLogAlertActionList { + /** + * The list of activity log alerts. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /** + * Get the list of activity log alerts. + * + * @return the actionGroups value + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the list of activity log alerts. + * + * @param actionGroups the actionGroups value to set + * @return the ActivityLogAlertActionList object itself. + */ + public ActivityLogAlertActionList withActionGroups(List actionGroups) { + this.actionGroups = actionGroups; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertAllOfCondition.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertAllOfCondition.java new file mode 100644 index 0000000000000..6f5e5a3989fcb --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertAllOfCondition.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met when all its member conditions + * are met. + */ +public class ActivityLogAlertAllOfCondition { + /** + * The list of activity log alert conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * Get the list of activity log alert conditions. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of activity log alert conditions. + * + * @param allOf the allOf value to set + * @return the ActivityLogAlertAllOfCondition object itself. + */ + public ActivityLogAlertAllOfCondition withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertLeafCondition.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertLeafCondition.java new file mode 100644 index 0000000000000..6ff10bd94b8c3 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertLeafCondition.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met by comparing an activity log + * field and value. + */ +public class ActivityLogAlertLeafCondition { + /** + * The name of the field that this condition will examine. The possible + * values for this field are (case-insensitive): 'resourceId', 'category', + * 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', + * 'status', 'subStatus', 'resourceType', or anything beginning with + * 'properties.'. + */ + @JsonProperty(value = "field", required = true) + private String field; + + /** + * The field value will be compared to this value (case-insensitive) to + * determine if the condition is met. + */ + @JsonProperty(value = "equals", required = true) + private String equals; + + /** + * Get the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @return the field value + */ + public String field() { + return this.field; + } + + /** + * Set the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @param field the field value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withField(String field) { + this.field = field; + return this; + } + + /** + * Get the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @return the equals value + */ + public String equals() { + return this.equals; + } + + /** + * Set the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @param equals the equals value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withEquals(String equals) { + this.equals = equals; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResource.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResource.java new file mode 100644 index 0000000000000..c1612fa71626b --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResource.java @@ -0,0 +1,166 @@ +/** + * 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.v2017_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation.MonitorManager; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation.ActivityLogAlertResourceInner; + +/** + * Type representing ActivityLogAlertResource. + */ +public interface ActivityLogAlertResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the actions value. + */ + ActivityLogAlertActionList actions(); + + /** + * @return the condition value. + */ + ActivityLogAlertAllOfCondition condition(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the scopes value. + */ + List scopes(); + + /** + * The entirety of the ActivityLogAlertResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithActions, DefinitionStages.WithCondition, DefinitionStages.WithScopes, DefinitionStages.WithCreate { + } + + /** + * Grouping of ActivityLogAlertResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ActivityLogAlertResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ActivityLogAlertResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions The actions that will activate when the condition is met + * @return the next definition stage +*/ + WithCondition withActions(ActivityLogAlertActionList actions); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Condition. + */ + interface WithCondition { + /** + * Specifies condition. + * @param condition The condition that will cause this alert to activate + * @return the next definition stage +*/ + WithScopes withCondition(ActivityLogAlertAllOfCondition condition); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Scopes. + */ + interface WithScopes { + /** + * Specifies scopes. + * @param scopes A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item + * @return the next definition stage +*/ + WithCreate withScopes(List scopes); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description A description of this activity log alert + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated + * @return the next definition stage + */ + WithCreate withEnabled(Boolean enabled); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithDescription, DefinitionStages.WithEnabled { + } + } + /** + * The template for a ActivityLogAlertResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of ActivityLogAlertResource update stages. + */ + interface UpdateStages { + /** + * The stage of the activitylogalertresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated + * @return the next update stage + */ + Update withEnabled(Boolean enabled); + } + + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResourcePatch.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResourcePatch.java new file mode 100644 index 0000000000000..d8720d981009a --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlertResourcePatch.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.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An activity log alert resource for patch operations. + */ +@JsonFlatten +public class ActivityLogAlertResourcePatch extends Resource { + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertResourcePatch object itself. + */ + public ActivityLogAlertResourcePatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlerts.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlerts.java new file mode 100644 index 0000000000000..a475ac8bf6f1f --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ActivityLogAlerts.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation.ActivityLogAlertsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActivityLogAlerts. + */ +public interface ActivityLogAlerts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponse.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..8715359968ade --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponseException.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponseException.java new file mode 100644 index 0000000000000..6c24037d29126 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceImpl.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceImpl.java new file mode 100644 index 0000000000000..146a320d6cc20 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceImpl.java @@ -0,0 +1,129 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertResourcePatch; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertAllOfCondition; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertActionList; +import rx.functions.Func1; + +class ActivityLogAlertResourceImpl extends GroupableResourceCoreImpl implements ActivityLogAlertResource, ActivityLogAlertResource.Definition, ActivityLogAlertResource.Update { + private ActivityLogAlertResourcePatch updateParameter; + ActivityLogAlertResourceImpl(String name, ActivityLogAlertResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new ActivityLogAlertResourcePatch(); + } + + @Override + public Observable createResourceAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ActivityLogAlertResourceInner call(ActivityLogAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ActivityLogAlertResourceInner call(ActivityLogAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ActivityLogAlertResourcePatch(); + } + + @Override + public ActivityLogAlertActionList actions() { + return this.inner().actions(); + } + + @Override + public ActivityLogAlertAllOfCondition condition() { + return this.inner().condition(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public List scopes() { + return this.inner().scopes(); + } + + @Override + public ActivityLogAlertResourceImpl withActions(ActivityLogAlertActionList actions) { + this.inner().withActions(actions); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withCondition(ActivityLogAlertAllOfCondition condition) { + this.inner().withCondition(condition); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withScopes(List scopes) { + this.inner().withScopes(scopes); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.inner().withEnabled(enabled); + } else { + this.updateParameter.withEnabled(enabled); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceInner.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceInner.java new file mode 100644 index 0000000000000..f29beb6b73091 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertResourceInner.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertAllOfCondition; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertActionList; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An activity log alert resource. + */ +@JsonFlatten +public class ActivityLogAlertResourceInner extends Resource { + /** + * A list of resourceIds that will be used as prefixes. The alert will only + * apply to activityLogs with resourceIds that fall under one of these + * prefixes. This list must include at least one item. + */ + @JsonProperty(value = "properties.scopes", required = true) + private List scopes; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * The condition that will cause this alert to activate. + */ + @JsonProperty(value = "properties.condition", required = true) + private ActivityLogAlertAllOfCondition condition; + + /** + * The actions that will activate when the condition is met. + */ + @JsonProperty(value = "properties.actions", required = true) + private ActivityLogAlertActionList actions; + + /** + * A description of this activity log alert. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Get a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @param scopes the scopes value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the condition that will cause this alert to activate. + * + * @return the condition value + */ + public ActivityLogAlertAllOfCondition condition() { + return this.condition; + } + + /** + * Set the condition that will cause this alert to activate. + * + * @param condition the condition value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withCondition(ActivityLogAlertAllOfCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions that will activate when the condition is met. + * + * @return the actions value + */ + public ActivityLogAlertActionList actions() { + return this.actions; + } + + /** + * Set the actions that will activate when the condition is met. + * + * @param actions the actions value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withActions(ActivityLogAlertActionList actions) { + this.actions = actions; + return this; + } + + /** + * Get a description of this activity log alert. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set a description of this activity log alert. + * + * @param description the description value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsImpl.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsImpl.java new file mode 100644 index 0000000000000..ab4ea4629313a --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ActivityLogAlertsImpl extends GroupableResourcesCoreImpl implements ActivityLogAlerts { + protected ActivityLogAlertsImpl(MonitorManager manager) { + super(manager.inner().activityLogAlerts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ActivityLogAlertsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ActivityLogAlertsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ActivityLogAlertsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ActivityLogAlertsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActivityLogAlertResource call(ActivityLogAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ActivityLogAlertsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ActivityLogAlertsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActivityLogAlertResource call(ActivityLogAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ActivityLogAlertResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ActivityLogAlertResourceImpl wrapModel(ActivityLogAlertResourceInner inner) { + return new ActivityLogAlertResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected ActivityLogAlertResourceImpl wrapModel(String name) { + return new ActivityLogAlertResourceImpl(name, new ActivityLogAlertResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsInner.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsInner.java new file mode 100644 index 0000000000000..3a849130dd3b7 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/ActivityLogAlertsInner.java @@ -0,0 +1,622 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlertResourcePatch; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActivityLogAlerts. + */ +public class ActivityLogAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActivityLogAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActivityLogAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActivityLogAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActivityLogAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActivityLogAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface ActivityLogAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertResourceInner activityLogAlert, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertResourcePatch activityLogAlertPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner createOrUpdate(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).toBlocking().single().body(); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert), serviceCallback); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (activityLogAlert == null) { + throw new IllegalArgumentException("Parameter activityLogAlert is required and cannot be null."); + } + Validator.validate(activityLogAlert); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), activityLogAlert, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String activityLogAlertName) { + deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String activityLogAlertName) { + return deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner update(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourcePatch activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).toBlocking().single().body(); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourcePatch activityLogAlertPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch), serviceCallback); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourcePatch activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourcePatch activityLogAlertPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (activityLogAlertPatch == null) { + throw new IllegalArgumentException("Parameter activityLogAlertPatch is required and cannot be null."); + } + Validator.validate(activityLogAlertPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), activityLogAlertPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/IdParsingUtils.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..61d2e75a659f3 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2017_03_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManagementClientImpl.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManagementClientImpl.java new file mode 100644 index 0000000000000..c8fd6152280aa --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,196 @@ +/** + * 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.v2017_03_01_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ActivityLogAlertsInner object to access its operations. + */ + private ActivityLogAlertsInner activityLogAlerts; + + /** + * Gets the ActivityLogAlertsInner object to access its operations. + * @return the ActivityLogAlertsInner object. + */ + public ActivityLogAlertsInner activityLogAlerts() { + return this.activityLogAlerts; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-03-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.activityLogAlerts = new ActivityLogAlertsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorManagementClient", "2017-03-01-preview"); + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManager.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManager.java new file mode 100644 index 0000000000000..5d0606d99a102 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/MonitorManager.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2017_03_01_preview.ActivityLogAlerts; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private ActivityLogAlerts activityLogAlerts; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ActivityLogAlerts. + */ + public ActivityLogAlerts activityLogAlerts() { + if (this.activityLogAlerts == null) { + this.activityLogAlerts = new ActivityLogAlertsImpl(this); + } + return this.activityLogAlerts; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/PageImpl.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..1489596a16d4d --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/package-info.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..75519602024f0 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2017_03_01_preview.implementation; diff --git a/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/package-info.java b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/package-info.java new file mode 100644 index 0000000000000..fe76c9a699831 --- /dev/null +++ b/monitor/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/monitor/v2017_03_01_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2017_03_01_preview; diff --git a/monitor/resource-manager/v2017_04_01/pom.xml b/monitor/resource-manager/v2017_04_01/pom.xml new file mode 100644 index 0000000000000..3113f83f2506f --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2017_04_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupPatchBody.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupPatchBody.java new file mode 100644 index 0000000000000..a689c957f876a --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An action group object for the body of patch operations. + */ +@JsonFlatten +public class ActionGroupPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupResource.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupResource.java new file mode 100644 index 0000000000000..5c9bf7146bba1 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroupResource.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.MonitorManager; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.ActionGroupResourceInner; + +/** + * Type representing ActionGroupResource. + */ +public interface ActionGroupResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the automationRunbookReceivers value. + */ + List automationRunbookReceivers(); + + /** + * @return the azureAppPushReceivers value. + */ + List azureAppPushReceivers(); + + /** + * @return the emailReceivers value. + */ + List emailReceivers(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the groupShortName value. + */ + String groupShortName(); + + /** + * @return the itsmReceivers value. + */ + List itsmReceivers(); + + /** + * @return the smsReceivers value. + */ + List smsReceivers(); + + /** + * @return the webhookReceivers value. + */ + List webhookReceivers(); + + /** + * The entirety of the ActionGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithEnabled, DefinitionStages.WithGroupShortName, DefinitionStages.WithCreate { + } + + /** + * Grouping of ActionGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ActionGroupResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ActionGroupResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the actiongroupresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications + * @return the next definition stage +*/ + WithGroupShortName withEnabled(boolean enabled); + } + + /** + * The stage of the actiongroupresource definition allowing to specify GroupShortName. + */ + interface WithGroupShortName { + /** + * Specifies groupShortName. + * @param groupShortName The short name of the action group. This will be used in SMS messages + * @return the next definition stage +*/ + WithCreate withGroupShortName(String groupShortName); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AutomationRunbookReceivers. + */ + interface WithAutomationRunbookReceivers { + /** + * Specifies automationRunbookReceivers. + * @param automationRunbookReceivers The list of AutomationRunbook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAutomationRunbookReceivers(List automationRunbookReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AzureAppPushReceivers. + */ + interface WithAzureAppPushReceivers { + /** + * Specifies azureAppPushReceivers. + * @param azureAppPushReceivers The list of AzureAppPush receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAzureAppPushReceivers(List azureAppPushReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify EmailReceivers. + */ + interface WithEmailReceivers { + /** + * Specifies emailReceivers. + * @param emailReceivers The list of email receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withEmailReceivers(List emailReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify ItsmReceivers. + */ + interface WithItsmReceivers { + /** + * Specifies itsmReceivers. + * @param itsmReceivers The list of ITSM receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withItsmReceivers(List itsmReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify SmsReceivers. + */ + interface WithSmsReceivers { + /** + * Specifies smsReceivers. + * @param smsReceivers The list of SMS receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withSmsReceivers(List smsReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify WebhookReceivers. + */ + interface WithWebhookReceivers { + /** + * Specifies webhookReceivers. + * @param webhookReceivers The list of webhook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withWebhookReceivers(List webhookReceivers); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutomationRunbookReceivers, DefinitionStages.WithAzureAppPushReceivers, DefinitionStages.WithEmailReceivers, DefinitionStages.WithItsmReceivers, DefinitionStages.WithSmsReceivers, DefinitionStages.WithWebhookReceivers { + } + } + /** + * The template for a ActionGroupResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of ActionGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the actiongroupresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated + * @return the next update stage + */ + Update withEnabled(Boolean enabled); + } + + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroups.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroups.java new file mode 100644 index 0000000000000..25998d3f292d6 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActionGroups.java @@ -0,0 +1,37 @@ +/** + * 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.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.ActionGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActionGroups. + */ +public interface ActionGroups extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName); + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionGroup.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionGroup.java new file mode 100644 index 0000000000000..d27877f7acea9 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionGroup.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A pointer to an Azure Action Group. + */ +public class ActivityLogAlertActionGroup { + /** + * The resourceId of the action group. This cannot be null or empty. + */ + @JsonProperty(value = "actionGroupId", required = true) + private String actionGroupId; + + /** + * the dictionary of custom properties to include with the post operation. + * These data are appended to the webhook payload. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the resourceId of the action group. This cannot be null or empty. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the resourceId of the action group. This cannot be null or empty. + * + * @param actionGroupId the actionGroupId value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. + * + * @param webhookProperties the webhookProperties value to set + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionList.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionList.java new file mode 100644 index 0000000000000..ae933af395865 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertActionList.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A list of activity log alert actions. + */ +public class ActivityLogAlertActionList { + /** + * The list of activity log alerts. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /** + * Get the list of activity log alerts. + * + * @return the actionGroups value + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the list of activity log alerts. + * + * @param actionGroups the actionGroups value to set + * @return the ActivityLogAlertActionList object itself. + */ + public ActivityLogAlertActionList withActionGroups(List actionGroups) { + this.actionGroups = actionGroups; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertAllOfCondition.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertAllOfCondition.java new file mode 100644 index 0000000000000..c4a4ad122f665 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertAllOfCondition.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met when all its member conditions + * are met. + */ +public class ActivityLogAlertAllOfCondition { + /** + * The list of activity log alert conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * Get the list of activity log alert conditions. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of activity log alert conditions. + * + * @param allOf the allOf value to set + * @return the ActivityLogAlertAllOfCondition object itself. + */ + public ActivityLogAlertAllOfCondition withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertLeafCondition.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertLeafCondition.java new file mode 100644 index 0000000000000..e59dca8d3a3e5 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertLeafCondition.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Activity Log alert condition that is met by comparing an activity log + * field and value. + */ +public class ActivityLogAlertLeafCondition { + /** + * The name of the field that this condition will examine. The possible + * values for this field are (case-insensitive): 'resourceId', 'category', + * 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', + * 'status', 'subStatus', 'resourceType', or anything beginning with + * 'properties.'. + */ + @JsonProperty(value = "field", required = true) + private String field; + + /** + * The field value will be compared to this value (case-insensitive) to + * determine if the condition is met. + */ + @JsonProperty(value = "equals", required = true) + private String equals; + + /** + * Get the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @return the field value + */ + public String field() { + return this.field; + } + + /** + * Set the name of the field that this condition will examine. The possible values for this field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @param field the field value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withField(String field) { + this.field = field; + return this; + } + + /** + * Get the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @return the equals value + */ + public String equals() { + return this.equals; + } + + /** + * Set the field value will be compared to this value (case-insensitive) to determine if the condition is met. + * + * @param equals the equals value to set + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withEquals(String equals) { + this.equals = equals; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertPatchBody.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertPatchBody.java new file mode 100644 index 0000000000000..37bd1e750861c --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An activity log alert object for the body of patch operations. + */ +@JsonFlatten +public class ActivityLogAlertPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertResource.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertResource.java new file mode 100644 index 0000000000000..a0ec22d435dc9 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlertResource.java @@ -0,0 +1,166 @@ +/** + * 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.v2017_04_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.MonitorManager; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.ActivityLogAlertResourceInner; + +/** + * Type representing ActivityLogAlertResource. + */ +public interface ActivityLogAlertResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the actions value. + */ + ActivityLogAlertActionList actions(); + + /** + * @return the condition value. + */ + ActivityLogAlertAllOfCondition condition(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the scopes value. + */ + List scopes(); + + /** + * The entirety of the ActivityLogAlertResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithActions, DefinitionStages.WithCondition, DefinitionStages.WithScopes, DefinitionStages.WithCreate { + } + + /** + * Grouping of ActivityLogAlertResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ActivityLogAlertResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ActivityLogAlertResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions The actions that will activate when the condition is met + * @return the next definition stage +*/ + WithCondition withActions(ActivityLogAlertActionList actions); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Condition. + */ + interface WithCondition { + /** + * Specifies condition. + * @param condition The condition that will cause this alert to activate + * @return the next definition stage +*/ + WithScopes withCondition(ActivityLogAlertAllOfCondition condition); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Scopes. + */ + interface WithScopes { + /** + * Specifies scopes. + * @param scopes A list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item + * @return the next definition stage +*/ + WithCreate withScopes(List scopes); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description A description of this activity log alert + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the activitylogalertresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated + * @return the next definition stage + */ + WithCreate withEnabled(Boolean enabled); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithDescription, DefinitionStages.WithEnabled { + } + } + /** + * The template for a ActivityLogAlertResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of ActivityLogAlertResource update stages. + */ + interface UpdateStages { + /** + * The stage of the activitylogalertresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated + * @return the next update stage + */ + Update withEnabled(Boolean enabled); + } + + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlerts.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlerts.java new file mode 100644 index 0000000000000..58ae7cad7d037 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ActivityLogAlerts.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.monitor.v2017_04_01.implementation.ActivityLogAlertsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActivityLogAlerts. + */ +public interface ActivityLogAlerts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AutomationRunbookReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AutomationRunbookReceiver.java new file mode 100644 index 0000000000000..145d0657c1f2a --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AutomationRunbookReceiver.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Automation Runbook notification receiver. + */ +public class AutomationRunbookReceiver { + /** + * The Azure automation account Id which holds this runbook and + * authenticate to Azure resource. + */ + @JsonProperty(value = "automationAccountId", required = true) + private String automationAccountId; + + /** + * The name for this runbook. + */ + @JsonProperty(value = "runbookName", required = true) + private String runbookName; + + /** + * The resource id for webhook linked to this runbook. + */ + @JsonProperty(value = "webhookResourceId", required = true) + private String webhookResourceId; + + /** + * Indicates whether this instance is global runbook. + */ + @JsonProperty(value = "isGlobalRunbook", required = true) + private boolean isGlobalRunbook; + + /** + * Indicates name of the webhook. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * Get the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @return the automationAccountId value + */ + public String automationAccountId() { + return this.automationAccountId; + } + + /** + * Set the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @param automationAccountId the automationAccountId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withAutomationAccountId(String automationAccountId) { + this.automationAccountId = automationAccountId; + return this; + } + + /** + * Get the name for this runbook. + * + * @return the runbookName value + */ + public String runbookName() { + return this.runbookName; + } + + /** + * Set the name for this runbook. + * + * @param runbookName the runbookName value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withRunbookName(String runbookName) { + this.runbookName = runbookName; + return this; + } + + /** + * Get the resource id for webhook linked to this runbook. + * + * @return the webhookResourceId value + */ + public String webhookResourceId() { + return this.webhookResourceId; + } + + /** + * Set the resource id for webhook linked to this runbook. + * + * @param webhookResourceId the webhookResourceId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withWebhookResourceId(String webhookResourceId) { + this.webhookResourceId = webhookResourceId; + return this; + } + + /** + * Get indicates whether this instance is global runbook. + * + * @return the isGlobalRunbook value + */ + public boolean isGlobalRunbook() { + return this.isGlobalRunbook; + } + + /** + * Set indicates whether this instance is global runbook. + * + * @param isGlobalRunbook the isGlobalRunbook value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withIsGlobalRunbook(boolean isGlobalRunbook) { + this.isGlobalRunbook = isGlobalRunbook; + return this; + } + + /** + * Get indicates name of the webhook. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set indicates name of the webhook. + * + * @param name the name value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AzureAppPushReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AzureAppPushReceiver.java new file mode 100644 index 0000000000000..c950c09c1fa7f --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/AzureAppPushReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure mobile App push notification receiver. + */ +public class AzureAppPushReceiver { + /** + * The name of the Azure mobile app push receiver. Names must be unique + * across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * Get the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address registered for the Azure mobile app. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EmailReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EmailReceiver.java new file mode 100644 index 0000000000000..2fe302dd9c91d --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EmailReceiver.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An email receiver. + */ +public class EmailReceiver { + /** + * The name of the email receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * The receiver status of the e-mail. Possible values include: + * 'NotSpecified', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address of this receiver. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of this receiver. + * + * @param emailAddress the emailAddress value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EnableRequest.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EnableRequest.java new file mode 100644 index 0000000000000..963cf9dcc1b97 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/EnableRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a receiver that should be resubscribed. + */ +public class EnableRequest { + /** + * The name of the receiver to resubscribe. + */ + @JsonProperty(value = "receiverName", required = true) + private String receiverName; + + /** + * Get the name of the receiver to resubscribe. + * + * @return the receiverName value + */ + public String receiverName() { + return this.receiverName; + } + + /** + * Set the name of the receiver to resubscribe. + * + * @param receiverName the receiverName value to set + * @return the EnableRequest object itself. + */ + public EnableRequest withReceiverName(String receiverName) { + this.receiverName = receiverName; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponse.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponse.java new file mode 100644 index 0000000000000..91f7b050241c4 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponseException.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponseException.java new file mode 100644 index 0000000000000..9566c6c311c83 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ItsmReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ItsmReceiver.java new file mode 100644 index 0000000000000..8e56bd4cd04d0 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ItsmReceiver.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Itsm receiver. + */ +public class ItsmReceiver { + /** + * The name of the Itsm receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * OMS LA instance identifier. + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /** + * Unique identification of ITSM connection among multiple defined in above + * workspace. + */ + @JsonProperty(value = "connectionId", required = true) + private String connectionId; + + /** + * JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + */ + @JsonProperty(value = "ticketConfiguration", required = true) + private String ticketConfiguration; + + /** + * Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get oMS LA instance identifier. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set oMS LA instance identifier. + * + * @param workspaceId the workspaceId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get unique identification of ITSM connection among multiple defined in above workspace. + * + * @return the connectionId value + */ + public String connectionId() { + return this.connectionId; + } + + /** + * Set unique identification of ITSM connection among multiple defined in above workspace. + * + * @param connectionId the connectionId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withConnectionId(String connectionId) { + this.connectionId = connectionId; + return this; + } + + /** + * Get jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @return the ticketConfiguration value + */ + public String ticketConfiguration() { + return this.ticketConfiguration; + } + + /** + * Set jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @param ticketConfiguration the ticketConfiguration value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withTicketConfiguration(String ticketConfiguration) { + this.ticketConfiguration = ticketConfiguration; + return this; + } + + /** + * Get region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @param region the region value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ReceiverStatus.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ReceiverStatus.java new file mode 100644 index 0000000000000..b4f2c185a9b0a --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/ReceiverStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReceiverStatus. + */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/SmsReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/SmsReceiver.java new file mode 100644 index 0000000000000..b6c4135baf381 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/SmsReceiver.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An SMS receiver. + */ +public class SmsReceiver { + /** + * The name of the SMS receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * The status of the receiver. Possible values include: 'NotSpecified', + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the SMS receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the SMS receiver. + * + * @param countryCode the countryCode value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the SMS receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/WebhookReceiver.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/WebhookReceiver.java new file mode 100644 index 0000000000000..d794c2645a3da --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/WebhookReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A webhook receiver. + */ +public class WebhookReceiver { + /** + * The name of the webhook receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /** + * Get the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceImpl.java new file mode 100644 index 0000000000000..6974b335a899e --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,168 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroupResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroupPatchBody; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.AutomationRunbookReceiver; +import rx.functions.Func1; + +class ActionGroupResourceImpl extends GroupableResourceCoreImpl implements ActionGroupResource, ActionGroupResource.Definition, ActionGroupResource.Update { + private ActionGroupPatchBody updateParameter; + ActionGroupResourceImpl(String name, ActionGroupResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public Observable createResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public List automationRunbookReceivers() { + return this.inner().automationRunbookReceivers(); + } + + @Override + public List azureAppPushReceivers() { + return this.inner().azureAppPushReceivers(); + } + + @Override + public List emailReceivers() { + return this.inner().emailReceivers(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String groupShortName() { + return this.inner().groupShortName(); + } + + @Override + public List itsmReceivers() { + return this.inner().itsmReceivers(); + } + + @Override + public List smsReceivers() { + return this.inner().smsReceivers(); + } + + @Override + public List webhookReceivers() { + return this.inner().webhookReceivers(); + } + + @Override + public ActionGroupResourceImpl withEnabled(boolean enabled) { + this.inner().withEnabled(enabled); + return this; + } + + @Override + public ActionGroupResourceImpl withGroupShortName(String groupShortName) { + this.inner().withGroupShortName(groupShortName); + return this; + } + + @Override + public ActionGroupResourceImpl withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.inner().withAutomationRunbookReceivers(automationRunbookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAzureAppPushReceivers(List azureAppPushReceivers) { + this.inner().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEmailReceivers(List emailReceivers) { + this.inner().withEmailReceivers(emailReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withItsmReceivers(List itsmReceivers) { + this.inner().withItsmReceivers(itsmReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withSmsReceivers(List smsReceivers) { + this.inner().withSmsReceivers(smsReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withWebhookReceivers(List webhookReceivers) { + this.inner().withWebhookReceivers(webhookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEnabled(Boolean enabled) { + this.updateParameter.withEnabled(enabled); + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceInner.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceInner.java new file mode 100644 index 0000000000000..a6d4bceb1a920 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupResourceInner.java @@ -0,0 +1,237 @@ +/** + * 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.v2017_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2017_04_01.AutomationRunbookReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An action group resource. + */ +@JsonFlatten +public class ActionGroupResourceInner extends Resource { + /** + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "properties.groupShortName", required = true) + private String groupShortName; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its receivers will receive communications. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "properties.emailReceivers") + private List emailReceivers; + + /** + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "properties.smsReceivers") + private List smsReceivers; + + /** + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "properties.webhookReceivers") + private List webhookReceivers; + + /** + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "properties.itsmReceivers") + private List itsmReceivers; + + /** + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureAppPushReceivers") + private List azureAppPushReceivers; + + /** + * The list of AutomationRunbook receivers that are part of this action + * group. + */ + @JsonProperty(value = "properties.automationRunbookReceivers") + private List automationRunbookReceivers; + + /** + * Get the short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of email receivers that are part of this action group. + * + * @return the emailReceivers value + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the list of AutomationRunbook receivers that are part of this action group. + * + * @return the automationRunbookReceivers value + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the list of AutomationRunbook receivers that are part of this action group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsImpl.java new file mode 100644 index 0000000000000..decef3f4bbec3 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsImpl.java @@ -0,0 +1,144 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroupResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ActionGroupsImpl extends GroupableResourcesCoreImpl implements ActionGroups { + protected ActionGroupsImpl(MonitorManager manager) { + super(manager.inner().actionGroups(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ActionGroupsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ActionGroupResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + ActionGroupsInner client = this.inner(); + return client.enableReceiverAsync(resourceGroupName, actionGroupName, receiverName).toCompletable(); + } + + @Override + protected ActionGroupResourceImpl wrapModel(ActionGroupResourceInner inner) { + return new ActionGroupResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected ActionGroupResourceImpl wrapModel(String name) { + return new ActionGroupResourceImpl(name, new ActionGroupResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsInner.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsInner.java new file mode 100644 index 0000000000000..3287196904a4b --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActionGroupsInner.java @@ -0,0 +1,723 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroupPatchBody; +import com.microsoft.azure.management.monitor.v2017_04_01.EnableRequest; +import com.microsoft.azure.management.monitor.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActionGroups. + */ +public class ActionGroupsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActionGroupsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActionGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActionGroupsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActionGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActionGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ActionGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Body ActionGroupResourceInner actionGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBody actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups enableReceiver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") + Observable> enableReceiver(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body EnableRequest enableRequest, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner createOrUpdate(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).toBlocking().single().body(); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup), serviceCallback); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (actionGroup == null) { + throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(actionGroup); + return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String actionGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String actionGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).toBlocking().single().body(); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch), serviceCallback); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (actionGroupPatch == null) { + throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); + } + Validator.validate(actionGroupPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, this.client.apiVersion(), actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableReceiver(String resourceGroupName, String actionGroupName, String receiverName) { + enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).toBlocking().single().body(); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName), serviceCallback); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + return enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableReceiverWithServiceResponseAsync(String resourceGroupName, String actionGroupName, String receiverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (receiverName == null) { + throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); + } + EnableRequest enableRequest = new EnableRequest(); + enableRequest.withReceiverName(receiverName); + return service.enableReceiver(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), enableRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableReceiverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableReceiverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceImpl.java new file mode 100644 index 0000000000000..aa0ff28dc5223 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceImpl.java @@ -0,0 +1,129 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertPatchBody; +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertAllOfCondition; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertActionList; +import rx.functions.Func1; + +class ActivityLogAlertResourceImpl extends GroupableResourceCoreImpl implements ActivityLogAlertResource, ActivityLogAlertResource.Definition, ActivityLogAlertResource.Update { + private ActivityLogAlertPatchBody updateParameter; + ActivityLogAlertResourceImpl(String name, ActivityLogAlertResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new ActivityLogAlertPatchBody(); + } + + @Override + public Observable createResourceAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ActivityLogAlertResourceInner call(ActivityLogAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ActivityLogAlertResourceInner call(ActivityLogAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ActivityLogAlertsInner client = this.manager().inner().activityLogAlerts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ActivityLogAlertPatchBody(); + } + + @Override + public ActivityLogAlertActionList actions() { + return this.inner().actions(); + } + + @Override + public ActivityLogAlertAllOfCondition condition() { + return this.inner().condition(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public List scopes() { + return this.inner().scopes(); + } + + @Override + public ActivityLogAlertResourceImpl withActions(ActivityLogAlertActionList actions) { + this.inner().withActions(actions); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withCondition(ActivityLogAlertAllOfCondition condition) { + this.inner().withCondition(condition); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withScopes(List scopes) { + this.inner().withScopes(scopes); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public ActivityLogAlertResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.inner().withEnabled(enabled); + } else { + this.updateParameter.withEnabled(enabled); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceInner.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceInner.java new file mode 100644 index 0000000000000..e8e9d17ada3cf --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertResourceInner.java @@ -0,0 +1,156 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertAllOfCondition; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertActionList; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An activity log alert resource. + */ +@JsonFlatten +public class ActivityLogAlertResourceInner extends Resource { + /** + * A list of resourceIds that will be used as prefixes. The alert will only + * apply to activityLogs with resourceIds that fall under one of these + * prefixes. This list must include at least one item. + */ + @JsonProperty(value = "properties.scopes", required = true) + private List scopes; + + /** + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * The condition that will cause this alert to activate. + */ + @JsonProperty(value = "properties.condition", required = true) + private ActivityLogAlertAllOfCondition condition; + + /** + * The actions that will activate when the condition is met. + */ + @JsonProperty(value = "properties.actions", required = true) + private ActivityLogAlertActionList actions; + + /** + * A description of this activity log alert. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Get a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set a list of resourceIds that will be used as prefixes. The alert will only apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @param scopes the scopes value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this activity log alert is enabled. If an activity log alert is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the condition that will cause this alert to activate. + * + * @return the condition value + */ + public ActivityLogAlertAllOfCondition condition() { + return this.condition; + } + + /** + * Set the condition that will cause this alert to activate. + * + * @param condition the condition value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withCondition(ActivityLogAlertAllOfCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions that will activate when the condition is met. + * + * @return the actions value + */ + public ActivityLogAlertActionList actions() { + return this.actions; + } + + /** + * Set the actions that will activate when the condition is met. + * + * @param actions the actions value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withActions(ActivityLogAlertActionList actions) { + this.actions = actions; + return this; + } + + /** + * Get a description of this activity log alert. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set a description of this activity log alert. + * + * @param description the description value to set + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsImpl.java new file mode 100644 index 0000000000000..8e21237789591 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2017_04_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ActivityLogAlertsImpl extends GroupableResourcesCoreImpl implements ActivityLogAlerts { + protected ActivityLogAlertsImpl(MonitorManager manager) { + super(manager.inner().activityLogAlerts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ActivityLogAlertsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ActivityLogAlertsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ActivityLogAlertsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ActivityLogAlertsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActivityLogAlertResource call(ActivityLogAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ActivityLogAlertsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ActivityLogAlertsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActivityLogAlertResource call(ActivityLogAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ActivityLogAlertResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ActivityLogAlertResourceImpl wrapModel(ActivityLogAlertResourceInner inner) { + return new ActivityLogAlertResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected ActivityLogAlertResourceImpl wrapModel(String name) { + return new ActivityLogAlertResourceImpl(name, new ActivityLogAlertResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsInner.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsInner.java new file mode 100644 index 0000000000000..a201a7d578502 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/ActivityLogAlertsInner.java @@ -0,0 +1,622 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlertPatchBody; +import com.microsoft.azure.management.monitor.v2017_04_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActivityLogAlerts. + */ +public class ActivityLogAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActivityLogAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActivityLogAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActivityLogAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActivityLogAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActivityLogAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface ActivityLogAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertResourceInner activityLogAlert, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("activityLogAlertName") String activityLogAlertName, @Query("api-version") String apiVersion, @Body ActivityLogAlertPatchBody activityLogAlertPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner createOrUpdate(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).toBlocking().single().body(); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert), serviceCallback); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (activityLogAlert == null) { + throw new IllegalArgumentException("Parameter activityLogAlert is required and cannot be null."); + } + Validator.validate(activityLogAlert); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), activityLogAlert, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String activityLogAlertName) { + deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).toBlocking().single().body(); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String activityLogAlertName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName), serviceCallback); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String activityLogAlertName) { + return deleteWithServiceResponseAsync(resourceGroupName, activityLogAlertName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActivityLogAlertResourceInner object if successful. + */ + public ActivityLogAlertResourceInner update(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).toBlocking().single().body(); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch), serviceCallback); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateWithServiceResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).map(new Func1, ActivityLogAlertResourceInner>() { + @Override + public ActivityLogAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActivityLogAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (activityLogAlertName == null) { + throw new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (activityLogAlertPatch == null) { + throw new IllegalArgumentException("Parameter activityLogAlertPatch is required and cannot be null."); + } + Validator.validate(activityLogAlertPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, activityLogAlertName, this.client.apiVersion(), activityLogAlertPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a subscription. + * + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActivityLogAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/IdParsingUtils.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..f6a0258efd62d --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2017_04_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManagementClientImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManagementClientImpl.java new file mode 100644 index 0000000000000..02a137b3faa9f --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,210 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ActionGroupsInner object to access its operations. + */ + private ActionGroupsInner actionGroups; + + /** + * Gets the ActionGroupsInner object to access its operations. + * @return the ActionGroupsInner object. + */ + public ActionGroupsInner actionGroups() { + return this.actionGroups; + } + + /** + * The ActivityLogAlertsInner object to access its operations. + */ + private ActivityLogAlertsInner activityLogAlerts; + + /** + * Gets the ActivityLogAlertsInner object to access its operations. + * @return the ActivityLogAlertsInner object. + */ + public ActivityLogAlertsInner activityLogAlerts() { + return this.activityLogAlerts; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-04-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.actionGroups = new ActionGroupsInner(restClient().retrofit(), this); + this.activityLogAlerts = new ActivityLogAlertsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorManagementClient", "2017-04-01"); + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManager.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManager.java new file mode 100644 index 0000000000000..5886ddce8ca3b --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/MonitorManager.java @@ -0,0 +1,111 @@ +/** + * 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.v2017_04_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2017_04_01.ActionGroups; +import com.microsoft.azure.management.monitor.v2017_04_01.ActivityLogAlerts; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private ActionGroups actionGroups; + private ActivityLogAlerts activityLogAlerts; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ActionGroups. + */ + public ActionGroups actionGroups() { + if (this.actionGroups == null) { + this.actionGroups = new ActionGroupsImpl(this); + } + return this.actionGroups; + } + + /** + * @return Entry point to manage ActivityLogAlerts. + */ + public ActivityLogAlerts activityLogAlerts() { + if (this.activityLogAlerts == null) { + this.activityLogAlerts = new ActivityLogAlertsImpl(this); + } + return this.activityLogAlerts; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/PageImpl.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..5d55c9f256c2d --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2017_04_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/package-info.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/package-info.java new file mode 100644 index 0000000000000..22740ea794614 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2017_04_01.implementation; diff --git a/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/package-info.java b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/package-info.java new file mode 100644 index 0000000000000..ca63b192fff50 --- /dev/null +++ b/monitor/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/monitor/v2017_04_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2017_04_01; diff --git a/monitor/resource-manager/v2018_03_01/pom.xml b/monitor/resource-manager/v2018_03_01/pom.xml new file mode 100644 index 0000000000000..5e4440137597b --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2018_03_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupPatchBody.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupPatchBody.java new file mode 100644 index 0000000000000..da213f7037d05 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An action group object for the body of patch operations. + */ +@JsonFlatten +public class ActionGroupPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupResource.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupResource.java new file mode 100644 index 0000000000000..68fbe927ee060 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroupResource.java @@ -0,0 +1,268 @@ +/** + * 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.v2018_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MonitorManager; +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.ActionGroupResourceInner; + +/** + * Type representing ActionGroupResource. + */ +public interface ActionGroupResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the automationRunbookReceivers value. + */ + List automationRunbookReceivers(); + + /** + * @return the azureAppPushReceivers value. + */ + List azureAppPushReceivers(); + + /** + * @return the azureFunctionReceivers value. + */ + List azureFunctionReceivers(); + + /** + * @return the emailReceivers value. + */ + List emailReceivers(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the groupShortName value. + */ + String groupShortName(); + + /** + * @return the itsmReceivers value. + */ + List itsmReceivers(); + + /** + * @return the logicAppReceivers value. + */ + List logicAppReceivers(); + + /** + * @return the smsReceivers value. + */ + List smsReceivers(); + + /** + * @return the voiceReceivers value. + */ + List voiceReceivers(); + + /** + * @return the webhookReceivers value. + */ + List webhookReceivers(); + + /** + * The entirety of the ActionGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithEnabled, DefinitionStages.WithGroupShortName, DefinitionStages.WithCreate { + } + + /** + * Grouping of ActionGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ActionGroupResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ActionGroupResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the actiongroupresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications + * @return the next definition stage +*/ + WithGroupShortName withEnabled(boolean enabled); + } + + /** + * The stage of the actiongroupresource definition allowing to specify GroupShortName. + */ + interface WithGroupShortName { + /** + * Specifies groupShortName. + * @param groupShortName The short name of the action group. This will be used in SMS messages + * @return the next definition stage +*/ + WithCreate withGroupShortName(String groupShortName); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AutomationRunbookReceivers. + */ + interface WithAutomationRunbookReceivers { + /** + * Specifies automationRunbookReceivers. + * @param automationRunbookReceivers The list of AutomationRunbook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAutomationRunbookReceivers(List automationRunbookReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AzureAppPushReceivers. + */ + interface WithAzureAppPushReceivers { + /** + * Specifies azureAppPushReceivers. + * @param azureAppPushReceivers The list of AzureAppPush receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAzureAppPushReceivers(List azureAppPushReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AzureFunctionReceivers. + */ + interface WithAzureFunctionReceivers { + /** + * Specifies azureFunctionReceivers. + * @param azureFunctionReceivers The list of azure function receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAzureFunctionReceivers(List azureFunctionReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify EmailReceivers. + */ + interface WithEmailReceivers { + /** + * Specifies emailReceivers. + * @param emailReceivers The list of email receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withEmailReceivers(List emailReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify ItsmReceivers. + */ + interface WithItsmReceivers { + /** + * Specifies itsmReceivers. + * @param itsmReceivers The list of ITSM receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withItsmReceivers(List itsmReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify LogicAppReceivers. + */ + interface WithLogicAppReceivers { + /** + * Specifies logicAppReceivers. + * @param logicAppReceivers The list of logic app receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withLogicAppReceivers(List logicAppReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify SmsReceivers. + */ + interface WithSmsReceivers { + /** + * Specifies smsReceivers. + * @param smsReceivers The list of SMS receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withSmsReceivers(List smsReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify VoiceReceivers. + */ + interface WithVoiceReceivers { + /** + * Specifies voiceReceivers. + * @param voiceReceivers The list of voice receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withVoiceReceivers(List voiceReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify WebhookReceivers. + */ + interface WithWebhookReceivers { + /** + * Specifies webhookReceivers. + * @param webhookReceivers The list of webhook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withWebhookReceivers(List webhookReceivers); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAutomationRunbookReceivers, DefinitionStages.WithAzureAppPushReceivers, DefinitionStages.WithAzureFunctionReceivers, DefinitionStages.WithEmailReceivers, DefinitionStages.WithItsmReceivers, DefinitionStages.WithLogicAppReceivers, DefinitionStages.WithSmsReceivers, DefinitionStages.WithVoiceReceivers, DefinitionStages.WithWebhookReceivers { + } + } + /** + * The template for a ActionGroupResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of ActionGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the actiongroupresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated + * @return the next update stage + */ + Update withEnabled(Boolean enabled); + } + + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroups.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroups.java new file mode 100644 index 0000000000000..daefe5f45027a --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ActionGroups.java @@ -0,0 +1,37 @@ +/** + * 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.v2018_03_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.ActionGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActionGroups. + */ +public interface ActionGroups extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName); + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AutomationRunbookReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AutomationRunbookReceiver.java new file mode 100644 index 0000000000000..083b01df6b529 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AutomationRunbookReceiver.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Automation Runbook notification receiver. + */ +public class AutomationRunbookReceiver { + /** + * The Azure automation account Id which holds this runbook and + * authenticate to Azure resource. + */ + @JsonProperty(value = "automationAccountId", required = true) + private String automationAccountId; + + /** + * The name for this runbook. + */ + @JsonProperty(value = "runbookName", required = true) + private String runbookName; + + /** + * The resource id for webhook linked to this runbook. + */ + @JsonProperty(value = "webhookResourceId", required = true) + private String webhookResourceId; + + /** + * Indicates whether this instance is global runbook. + */ + @JsonProperty(value = "isGlobalRunbook", required = true) + private boolean isGlobalRunbook; + + /** + * Indicates name of the webhook. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * Get the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @return the automationAccountId value + */ + public String automationAccountId() { + return this.automationAccountId; + } + + /** + * Set the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @param automationAccountId the automationAccountId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withAutomationAccountId(String automationAccountId) { + this.automationAccountId = automationAccountId; + return this; + } + + /** + * Get the name for this runbook. + * + * @return the runbookName value + */ + public String runbookName() { + return this.runbookName; + } + + /** + * Set the name for this runbook. + * + * @param runbookName the runbookName value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withRunbookName(String runbookName) { + this.runbookName = runbookName; + return this; + } + + /** + * Get the resource id for webhook linked to this runbook. + * + * @return the webhookResourceId value + */ + public String webhookResourceId() { + return this.webhookResourceId; + } + + /** + * Set the resource id for webhook linked to this runbook. + * + * @param webhookResourceId the webhookResourceId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withWebhookResourceId(String webhookResourceId) { + this.webhookResourceId = webhookResourceId; + return this; + } + + /** + * Get indicates whether this instance is global runbook. + * + * @return the isGlobalRunbook value + */ + public boolean isGlobalRunbook() { + return this.isGlobalRunbook; + } + + /** + * Set indicates whether this instance is global runbook. + * + * @param isGlobalRunbook the isGlobalRunbook value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withIsGlobalRunbook(boolean isGlobalRunbook) { + this.isGlobalRunbook = isGlobalRunbook; + return this; + } + + /** + * Get indicates name of the webhook. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set indicates name of the webhook. + * + * @param name the name value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureAppPushReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureAppPushReceiver.java new file mode 100644 index 0000000000000..5038cf8b446c0 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureAppPushReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure mobile App push notification receiver. + */ +public class AzureAppPushReceiver { + /** + * The name of the Azure mobile app push receiver. Names must be unique + * across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * Get the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address registered for the Azure mobile app. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureFunctionReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureFunctionReceiver.java new file mode 100644 index 0000000000000..9c46a5bd5757d --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/AzureFunctionReceiver.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An azure function receiver. + */ +public class AzureFunctionReceiver { + /** + * The name of the azure function receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the function app. + */ + @JsonProperty(value = "functionAppResourceId", required = true) + private String functionAppResourceId; + + /** + * The function name in the function app. + */ + @JsonProperty(value = "functionName", required = true) + private String functionName; + + /** + * The http trigger url where http request sent to. + */ + @JsonProperty(value = "httpTriggerUrl", required = true) + private String httpTriggerUrl; + + /** + * Get the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the function app. + * + * @return the functionAppResourceId value + */ + public String functionAppResourceId() { + return this.functionAppResourceId; + } + + /** + * Set the azure resource id of the function app. + * + * @param functionAppResourceId the functionAppResourceId value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionAppResourceId(String functionAppResourceId) { + this.functionAppResourceId = functionAppResourceId; + return this; + } + + /** + * Get the function name in the function app. + * + * @return the functionName value + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the function name in the function app. + * + * @param functionName the functionName value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the http trigger url where http request sent to. + * + * @return the httpTriggerUrl value + */ + public String httpTriggerUrl() { + return this.httpTriggerUrl; + } + + /** + * Set the http trigger url where http request sent to. + * + * @param httpTriggerUrl the httpTriggerUrl value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withHttpTriggerUrl(String httpTriggerUrl) { + this.httpTriggerUrl = httpTriggerUrl; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicMetricCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicMetricCriteria.java new file mode 100644 index 0000000000000..db6ddf726f4a8 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicMetricCriteria.java @@ -0,0 +1,130 @@ +/** + * 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.v2018_03_01; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Criterion for dynamic threshold. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("DynamicThresholdCriterion") +public class DynamicMetricCriteria extends MultiMetricCriteria { + /** + * The operator used to compare the metric value against the threshold. + */ + @JsonProperty(value = "operator", required = true) + private Object operator; + + /** + * The extent of deviation required to trigger an alert. This will affect + * how tight the threshold is to the metric series pattern. + */ + @JsonProperty(value = "alertSensitivity", required = true) + private Object alertSensitivity; + + /** + * The minimum number of violations required within the selected lookback + * time window required to raise an alert. + */ + @JsonProperty(value = "failingPeriods", required = true) + private DynamicThresholdFailingPeriods failingPeriods; + + /** + * Use this option to set the date from which to start learning the metric + * historical data and calculate the dynamic thresholds (in ISO8601 + * format). + */ + @JsonProperty(value = "ignoreDataBefore") + private DateTime ignoreDataBefore; + + /** + * Get the operator used to compare the metric value against the threshold. + * + * @return the operator value + */ + public Object operator() { + return this.operator; + } + + /** + * Set the operator used to compare the metric value against the threshold. + * + * @param operator the operator value to set + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withOperator(Object operator) { + this.operator = operator; + return this; + } + + /** + * Get the extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. + * + * @return the alertSensitivity value + */ + public Object alertSensitivity() { + return this.alertSensitivity; + } + + /** + * Set the extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern. + * + * @param alertSensitivity the alertSensitivity value to set + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withAlertSensitivity(Object alertSensitivity) { + this.alertSensitivity = alertSensitivity; + return this; + } + + /** + * Get the minimum number of violations required within the selected lookback time window required to raise an alert. + * + * @return the failingPeriods value + */ + public DynamicThresholdFailingPeriods failingPeriods() { + return this.failingPeriods; + } + + /** + * Set the minimum number of violations required within the selected lookback time window required to raise an alert. + * + * @param failingPeriods the failingPeriods value to set + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { + this.failingPeriods = failingPeriods; + return this; + } + + /** + * Get use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format). + * + * @return the ignoreDataBefore value + */ + public DateTime ignoreDataBefore() { + return this.ignoreDataBefore; + } + + /** + * Set use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format). + * + * @param ignoreDataBefore the ignoreDataBefore value to set + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withIgnoreDataBefore(DateTime ignoreDataBefore) { + this.ignoreDataBefore = ignoreDataBefore; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicThresholdFailingPeriods.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicThresholdFailingPeriods.java new file mode 100644 index 0000000000000..d98899299d5da --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/DynamicThresholdFailingPeriods.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum number of violations required within the selected lookback time + * window required to raise an alert. + */ +public class DynamicThresholdFailingPeriods { + /** + * The number of aggregated lookback points. The lookback time window is + * calculated based on the aggregation granularity (windowSize) and the + * selected number of aggregated points. + */ + @JsonProperty(value = "numberOfEvaluationPeriods", required = true) + private double numberOfEvaluationPeriods; + + /** + * The number of violations to trigger an alert. Should be smaller or equal + * to numberOfEvaluationPeriods. + */ + @JsonProperty(value = "minFailingPeriodsToAlert", required = true) + private double minFailingPeriodsToAlert; + + /** + * Get the number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. + * + * @return the numberOfEvaluationPeriods value + */ + public double numberOfEvaluationPeriods() { + return this.numberOfEvaluationPeriods; + } + + /** + * Set the number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. + * + * @param numberOfEvaluationPeriods the numberOfEvaluationPeriods value to set + * @return the DynamicThresholdFailingPeriods object itself. + */ + public DynamicThresholdFailingPeriods withNumberOfEvaluationPeriods(double numberOfEvaluationPeriods) { + this.numberOfEvaluationPeriods = numberOfEvaluationPeriods; + return this; + } + + /** + * Get the number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + * + * @return the minFailingPeriodsToAlert value + */ + public double minFailingPeriodsToAlert() { + return this.minFailingPeriodsToAlert; + } + + /** + * Set the number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + * + * @param minFailingPeriodsToAlert the minFailingPeriodsToAlert value to set + * @return the DynamicThresholdFailingPeriods object itself. + */ + public DynamicThresholdFailingPeriods withMinFailingPeriodsToAlert(double minFailingPeriodsToAlert) { + this.minFailingPeriodsToAlert = minFailingPeriodsToAlert; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EmailReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EmailReceiver.java new file mode 100644 index 0000000000000..d85d33fcf1b62 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EmailReceiver.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An email receiver. + */ +public class EmailReceiver { + /** + * The name of the email receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * The receiver status of the e-mail. Possible values include: + * 'NotSpecified', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address of this receiver. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of this receiver. + * + * @param emailAddress the emailAddress value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EnableRequest.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EnableRequest.java new file mode 100644 index 0000000000000..5d464173e11a0 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/EnableRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a receiver that should be resubscribed. + */ +public class EnableRequest { + /** + * The name of the receiver to resubscribe. + */ + @JsonProperty(value = "receiverName", required = true) + private String receiverName; + + /** + * Get the name of the receiver to resubscribe. + * + * @return the receiverName value + */ + public String receiverName() { + return this.receiverName; + } + + /** + * Set the name of the receiver to resubscribe. + * + * @param receiverName the receiverName value to set + * @return the EnableRequest object itself. + */ + public EnableRequest withReceiverName(String receiverName) { + this.receiverName = receiverName; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponse.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponse.java new file mode 100644 index 0000000000000..7d917fee96d39 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponseException.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponseException.java new file mode 100644 index 0000000000000..84fa1732b2460 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ItsmReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ItsmReceiver.java new file mode 100644 index 0000000000000..1e2e20c35054e --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ItsmReceiver.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Itsm receiver. + */ +public class ItsmReceiver { + /** + * The name of the Itsm receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * OMS LA instance identifier. + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /** + * Unique identification of ITSM connection among multiple defined in above + * workspace. + */ + @JsonProperty(value = "connectionId", required = true) + private String connectionId; + + /** + * JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + */ + @JsonProperty(value = "ticketConfiguration", required = true) + private String ticketConfiguration; + + /** + * Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get oMS LA instance identifier. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set oMS LA instance identifier. + * + * @param workspaceId the workspaceId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get unique identification of ITSM connection among multiple defined in above workspace. + * + * @return the connectionId value + */ + public String connectionId() { + return this.connectionId; + } + + /** + * Set unique identification of ITSM connection among multiple defined in above workspace. + * + * @param connectionId the connectionId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withConnectionId(String connectionId) { + this.connectionId = connectionId; + return this; + } + + /** + * Get jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @return the ticketConfiguration value + */ + public String ticketConfiguration() { + return this.ticketConfiguration; + } + + /** + * Set jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @param ticketConfiguration the ticketConfiguration value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withTicketConfiguration(String ticketConfiguration) { + this.ticketConfiguration = ticketConfiguration; + return this; + } + + /** + * Get region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @param region the region value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/LogicAppReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/LogicAppReceiver.java new file mode 100644 index 0000000000000..deafdeb23951a --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/LogicAppReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A logic app receiver. + */ +public class LogicAppReceiver { + /** + * The name of the logic app receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the logic app receiver. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * The callback url where http request sent to. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /** + * Get the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the logic app receiver. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the azure resource id of the logic app receiver. + * + * @param resourceId the resourceId value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the callback url where http request sent to. + * + * @return the callbackUrl value + */ + public String callbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callback url where http request sent to. + * + * @param callbackUrl the callbackUrl value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertAction.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertAction.java new file mode 100644 index 0000000000000..0c3aa3e6a8769 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertAction.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert action. + */ +public class MetricAlertAction { + /** + * the id of the action group to use. + */ + @JsonProperty(value = "actionGroupId") + private String actionGroupId; + + /** + * The properties of a webhook object. + */ + @JsonProperty(value = "webhookProperties") + private Map webhookProperties; + + /** + * Get the id of the action group to use. + * + * @return the actionGroupId value + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the id of the action group to use. + * + * @param actionGroupId the actionGroupId value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the properties of a webhook object. + * + * @return the webhookProperties value + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the properties of a webhook object. + * + * @param webhookProperties the webhookProperties value to set + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertCriteria.java new file mode 100644 index 0000000000000..3f3408c0a329c --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertCriteria.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The rule criteria that defines the conditions of the alert rule. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("MetricAlertCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", value = MetricAlertSingleResourceMultipleMetricCriteria.class), + @JsonSubTypes.Type(name = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", value = MetricAlertMultipleResourceMultipleMetricCriteria.class) +}) +public class MetricAlertCriteria { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the MetricAlertCriteria object itself. + */ + public MetricAlertCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertMultipleResourceMultipleMetricCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertMultipleResourceMultipleMetricCriteria.java new file mode 100644 index 0000000000000..623ef6f80d20e --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertMultipleResourceMultipleMetricCriteria.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the metric alert criteria for multiple resource that has multiple + * metric criteria. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria") +public class MetricAlertMultipleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /** + * the list of multiple metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** + * Get the list of multiple metric criteria for this 'all of' operation. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of multiple metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set + * @return the MetricAlertMultipleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertMultipleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResource.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResource.java new file mode 100644 index 0000000000000..b2980126349dc --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResource.java @@ -0,0 +1,323 @@ +/** + * 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.v2018_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MonitorManager; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MetricAlertResourceInner; + +/** + * Type representing MetricAlertResource. + */ +public interface MetricAlertResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the actions value. + */ + List actions(); + + /** + * @return the autoMitigate value. + */ + Boolean autoMitigate(); + + /** + * @return the criteria value. + */ + MetricAlertCriteria criteria(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the evaluationFrequency value. + */ + Period evaluationFrequency(); + + /** + * @return the lastUpdatedTime value. + */ + DateTime lastUpdatedTime(); + + /** + * @return the scopes value. + */ + List scopes(); + + /** + * @return the severity value. + */ + int severity(); + + /** + * @return the targetResourceRegion value. + */ + String targetResourceRegion(); + + /** + * @return the targetResourceType value. + */ + String targetResourceType(); + + /** + * @return the windowSize value. + */ + Period windowSize(); + + /** + * The entirety of the MetricAlertResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCriteria, DefinitionStages.WithDescription, DefinitionStages.WithEnabled, DefinitionStages.WithEvaluationFrequency, DefinitionStages.WithSeverity, DefinitionStages.WithWindowSize, DefinitionStages.WithCreate { + } + + /** + * Grouping of MetricAlertResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a MetricAlertResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the MetricAlertResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the metricalertresource definition allowing to specify Criteria. + */ + interface WithCriteria { + /** + * Specifies criteria. + * @param criteria defines the specific alert criteria information + * @return the next definition stage +*/ + WithDescription withCriteria(MetricAlertCriteria criteria); + } + + /** + * The stage of the metricalertresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description the description of the metric alert that will be included in the alert email + * @return the next definition stage +*/ + WithEnabled withDescription(String description); + } + + /** + * The stage of the metricalertresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled the flag that indicates whether the metric alert is enabled + * @return the next definition stage +*/ + WithEvaluationFrequency withEnabled(boolean enabled); + } + + /** + * The stage of the metricalertresource definition allowing to specify EvaluationFrequency. + */ + interface WithEvaluationFrequency { + /** + * Specifies evaluationFrequency. + * @param evaluationFrequency how often the metric alert is evaluated represented in ISO 8601 duration format + * @return the next definition stage +*/ + WithSeverity withEvaluationFrequency(Period evaluationFrequency); + } + + /** + * The stage of the metricalertresource definition allowing to specify Severity. + */ + interface WithSeverity { + /** + * Specifies severity. + * @param severity Alert severity {0, 1, 2, 3, 4} + * @return the next definition stage +*/ + WithWindowSize withSeverity(int severity); + } + + /** + * The stage of the metricalertresource definition allowing to specify WindowSize. + */ + interface WithWindowSize { + /** + * Specifies windowSize. + * @param windowSize the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold + * @return the next definition stage +*/ + WithCreate withWindowSize(Period windowSize); + } + + /** + * The stage of the metricalertresource definition allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved + * @return the next definition stage + */ + WithCreate withActions(List actions); + } + + /** + * The stage of the metricalertresource definition allowing to specify AutoMitigate. + */ + interface WithAutoMitigate { + /** + * Specifies autoMitigate. + * @param autoMitigate the flag that indicates whether the alert should be auto resolved or not + * @return the next definition stage + */ + WithCreate withAutoMitigate(Boolean autoMitigate); + } + + /** + * The stage of the metricalertresource definition allowing to specify Scopes. + */ + interface WithScopes { + /** + * Specifies scopes. + * @param scopes the list of resource id's that this metric alert is scoped to + * @return the next definition stage + */ + WithCreate withScopes(List scopes); + } + + /** + * The stage of the metricalertresource definition allowing to specify TargetResourceRegion. + */ + interface WithTargetResourceRegion { + /** + * Specifies targetResourceRegion. + * @param targetResourceRegion the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria + * @return the next definition stage + */ + WithCreate withTargetResourceRegion(String targetResourceRegion); + } + + /** + * The stage of the metricalertresource definition allowing to specify TargetResourceType. + */ + interface WithTargetResourceType { + /** + * Specifies targetResourceType. + * @param targetResourceType the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria + * @return the next definition stage + */ + WithCreate withTargetResourceType(String targetResourceType); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithActions, DefinitionStages.WithAutoMitigate, DefinitionStages.WithScopes, DefinitionStages.WithTargetResourceRegion, DefinitionStages.WithTargetResourceType { + } + } + /** + * The template for a MetricAlertResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithActions, UpdateStages.WithAutoMitigate, UpdateStages.WithScopes, UpdateStages.WithTargetResourceRegion, UpdateStages.WithTargetResourceType { + } + + /** + * Grouping of MetricAlertResource update stages. + */ + interface UpdateStages { + /** + * The stage of the metricalertresource update allowing to specify Actions. + */ + interface WithActions { + /** + * Specifies actions. + * @param actions the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved + * @return the next update stage + */ + Update withActions(List actions); + } + + /** + * The stage of the metricalertresource update allowing to specify AutoMitigate. + */ + interface WithAutoMitigate { + /** + * Specifies autoMitigate. + * @param autoMitigate the flag that indicates whether the alert should be auto resolved or not + * @return the next update stage + */ + Update withAutoMitigate(Boolean autoMitigate); + } + + /** + * The stage of the metricalertresource update allowing to specify Scopes. + */ + interface WithScopes { + /** + * Specifies scopes. + * @param scopes the list of resource id's that this metric alert is scoped to + * @return the next update stage + */ + Update withScopes(List scopes); + } + + /** + * The stage of the metricalertresource update allowing to specify TargetResourceRegion. + */ + interface WithTargetResourceRegion { + /** + * Specifies targetResourceRegion. + * @param targetResourceRegion the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria + * @return the next update stage + */ + Update withTargetResourceRegion(String targetResourceRegion); + } + + /** + * The stage of the metricalertresource update allowing to specify TargetResourceType. + */ + interface WithTargetResourceType { + /** + * Specifies targetResourceType. + * @param targetResourceType the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria + * @return the next update stage + */ + Update withTargetResourceType(String targetResourceType); + } + + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResourcePatch.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResourcePatch.java new file mode 100644 index 0000000000000..c8c04039ed03f --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertResourcePatch.java @@ -0,0 +1,357 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.Map; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The metric alert resource for patch operations. + */ +@JsonFlatten +public class MetricAlertResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceType") + private String targetResourceType; + + /** + * the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceRegion") + private String targetResourceRegion; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description of the metric alert that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get defines the specific alert criteria information. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set defines the specific alert criteria information. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the flag that indicates whether the alert should be auto resolved or not. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the flag that indicates whether the alert should be auto resolved or not. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertSingleResourceMultipleMetricCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertSingleResourceMultipleMetricCriteria.java new file mode 100644 index 0000000000000..a60ff764610d4 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertSingleResourceMultipleMetricCriteria.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specifies the metric alert criteria for a single resource that has multiple + * metric criteria. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria") +public class MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /** + * The list of metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** + * Get the list of metric criteria for this 'all of' operation. + * + * @return the allOf value + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the list of metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set + * @return the MetricAlertSingleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertSingleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatus.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatus.java new file mode 100644 index 0000000000000..73725542d671b --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatus.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status. + */ +public class MetricAlertStatus { + /** + * The status name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The alert rule arm id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The extended resource type name. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The alert status properties of the metric alert status. + */ + @JsonProperty(value = "properties") + private MetricAlertStatusProperties properties; + + /** + * Get the status name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the status name. + * + * @param name the name value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withName(String name) { + this.name = name; + return this; + } + + /** + * Get the alert rule arm id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the alert rule arm id. + * + * @param id the id value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withId(String id) { + this.id = id; + return this; + } + + /** + * Get the extended resource type name. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the extended resource type name. + * + * @param type the type value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withType(String type) { + this.type = type; + return this; + } + + /** + * Get the alert status properties of the metric alert status. + * + * @return the properties value + */ + public MetricAlertStatusProperties properties() { + return this.properties; + } + + /** + * Set the alert status properties of the metric alert status. + * + * @param properties the properties value to set + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withProperties(MetricAlertStatusProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusCollection.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusCollection.java new file mode 100644 index 0000000000000..c1a5c44f512de --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusCollection.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MetricAlertStatusCollectionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MonitorManager; +import java.util.List; + +/** + * Type representing MetricAlertStatusCollection. + */ +public interface MetricAlertStatusCollection extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusProperties.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusProperties.java new file mode 100644 index 0000000000000..e75f61ca8eb47 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertStatusProperties.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.Map; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An alert status properties. + */ +public class MetricAlertStatusProperties { + /** + * An object describing the type of the dimensions. + */ + @JsonProperty(value = "dimensions") + private Map dimensions; + + /** + * status value. + */ + @JsonProperty(value = "status") + private String status; + + /** + * UTC time when the status was checked. + */ + @JsonProperty(value = "timestamp") + private DateTime timestamp; + + /** + * Get an object describing the type of the dimensions. + * + * @return the dimensions value + */ + public Map dimensions() { + return this.dimensions; + } + + /** + * Set an object describing the type of the dimensions. + * + * @param dimensions the dimensions value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withDimensions(Map dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get status value. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status value. + * + * @param status the status value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get uTC time when the status was checked. + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Set uTC time when the status was checked. + * + * @param timestamp the timestamp value to set + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withTimestamp(DateTime timestamp) { + this.timestamp = timestamp; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlerts.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlerts.java new file mode 100644 index 0000000000000..5ae5aa7e124d1 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlerts.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MetricAlertsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MetricAlerts. + */ +public interface MetricAlerts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertsStatus.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertsStatus.java new file mode 100644 index 0000000000000..0b0a5bbf83dde --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertsStatus.java @@ -0,0 +1,40 @@ +/** + * 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.v2018_03_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_03_01.implementation.MetricAlertsStatusInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MetricAlertsStatus. + */ +public interface MetricAlertsStatus extends HasInner { + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String ruleName); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByNameAsync(String resourceGroupName, String ruleName, String statusName); + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricCriteria.java new file mode 100644 index 0000000000000..96aa6dc088e64 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricCriteria.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Criterion to filter metrics. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("StaticThresholdCriterion") +public class MetricCriteria extends MultiMetricCriteria { + /** + * the criteria operator. + */ + @JsonProperty(value = "operator", required = true) + private Object operator; + + /** + * the criteria threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * Get the criteria operator. + * + * @return the operator value + */ + public Object operator() { + return this.operator; + } + + /** + * Set the criteria operator. + * + * @param operator the operator value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withOperator(Object operator) { + this.operator = operator; + return this; + } + + /** + * Get the criteria threshold value that activates the alert. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the criteria threshold value that activates the alert. + * + * @param threshold the threshold value to set + * @return the MetricCriteria object itself. + */ + public MetricCriteria withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricDimension.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricDimension.java new file mode 100644 index 0000000000000..2a5253f465577 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricDimension.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies a metric dimension. + */ +public class MetricDimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * the dimension operator. Only 'Include' and 'Exclude' are supported. + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /** + * list of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Get name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the dimension. + * + * @param name the name value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @param operator the operator value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get list of dimension values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set list of dimension values. + * + * @param values the values value to set + * @return the MetricDimension object itself. + */ + public MetricDimension withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MultiMetricCriteria.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MultiMetricCriteria.java new file mode 100644 index 0000000000000..84c162a76f5f8 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MultiMetricCriteria.java @@ -0,0 +1,184 @@ +/** + * 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.v2018_03_01; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * The types of conditions for a multi resource alert. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("MultiMetricCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "StaticThresholdCriterion", value = MetricCriteria.class), + @JsonSubTypes.Type(name = "DynamicThresholdCriterion", value = DynamicMetricCriteria.class) +}) +public class MultiMetricCriteria { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Name of the criteria. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * Namespace of the metric. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /** + * the criteria time aggregation types. + */ + @JsonProperty(value = "timeAggregation", required = true) + private Object timeAggregation; + + /** + * List of dimension conditions. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get name of the criteria. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the criteria. + * + * @param name the name value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withName(String name) { + this.name = name; + return this; + } + + /** + * Get name of the metric. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set name of the metric. + * + * @param metricName the metricName value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get namespace of the metric. + * + * @return the metricNamespace value + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set namespace of the metric. + * + * @param metricNamespace the metricNamespace value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Get the criteria time aggregation types. + * + * @return the timeAggregation value + */ + public Object timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the criteria time aggregation types. + * + * @param timeAggregation the timeAggregation value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withTimeAggregation(Object timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get list of dimension conditions. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set list of dimension conditions. + * + * @param dimensions the dimensions value to set + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ReceiverStatus.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ReceiverStatus.java new file mode 100644 index 0000000000000..9768905ce6057 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/ReceiverStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReceiverStatus. + */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/SmsReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/SmsReceiver.java new file mode 100644 index 0000000000000..5fa6917695133 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/SmsReceiver.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An SMS receiver. + */ +public class SmsReceiver { + /** + * The name of the SMS receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * The status of the receiver. Possible values include: 'NotSpecified', + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the SMS receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the SMS receiver. + * + * @param countryCode the countryCode value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the SMS receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/VoiceReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/VoiceReceiver.java new file mode 100644 index 0000000000000..7ca6400e8b41f --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/VoiceReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A voice receiver. + */ +public class VoiceReceiver { + /** + * The name of the voice receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the voice receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the voice receiver. + * + * @param countryCode the countryCode value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the voice receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the voice receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/WebhookReceiver.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/WebhookReceiver.java new file mode 100644 index 0000000000000..8c39ddb221f1f --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/WebhookReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A webhook receiver. + */ +public class WebhookReceiver { + /** + * The name of the webhook receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /** + * Get the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceImpl.java new file mode 100644 index 0000000000000..5c351394c32f8 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroupResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroupPatchBody; +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_03_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.VoiceReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.LogicAppReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AzureFunctionReceiver; +import rx.functions.Func1; + +class ActionGroupResourceImpl extends GroupableResourceCoreImpl implements ActionGroupResource, ActionGroupResource.Definition, ActionGroupResource.Update { + private ActionGroupPatchBody updateParameter; + ActionGroupResourceImpl(String name, ActionGroupResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public Observable createResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public List automationRunbookReceivers() { + return this.inner().automationRunbookReceivers(); + } + + @Override + public List azureAppPushReceivers() { + return this.inner().azureAppPushReceivers(); + } + + @Override + public List azureFunctionReceivers() { + return this.inner().azureFunctionReceivers(); + } + + @Override + public List emailReceivers() { + return this.inner().emailReceivers(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String groupShortName() { + return this.inner().groupShortName(); + } + + @Override + public List itsmReceivers() { + return this.inner().itsmReceivers(); + } + + @Override + public List logicAppReceivers() { + return this.inner().logicAppReceivers(); + } + + @Override + public List smsReceivers() { + return this.inner().smsReceivers(); + } + + @Override + public List voiceReceivers() { + return this.inner().voiceReceivers(); + } + + @Override + public List webhookReceivers() { + return this.inner().webhookReceivers(); + } + + @Override + public ActionGroupResourceImpl withEnabled(boolean enabled) { + this.inner().withEnabled(enabled); + return this; + } + + @Override + public ActionGroupResourceImpl withGroupShortName(String groupShortName) { + this.inner().withGroupShortName(groupShortName); + return this; + } + + @Override + public ActionGroupResourceImpl withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.inner().withAutomationRunbookReceivers(automationRunbookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAzureAppPushReceivers(List azureAppPushReceivers) { + this.inner().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAzureFunctionReceivers(List azureFunctionReceivers) { + this.inner().withAzureFunctionReceivers(azureFunctionReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEmailReceivers(List emailReceivers) { + this.inner().withEmailReceivers(emailReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withItsmReceivers(List itsmReceivers) { + this.inner().withItsmReceivers(itsmReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withLogicAppReceivers(List logicAppReceivers) { + this.inner().withLogicAppReceivers(logicAppReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withSmsReceivers(List smsReceivers) { + this.inner().withSmsReceivers(smsReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withVoiceReceivers(List voiceReceivers) { + this.inner().withVoiceReceivers(voiceReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withWebhookReceivers(List webhookReceivers) { + this.inner().withWebhookReceivers(webhookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEnabled(Boolean enabled) { + this.updateParameter.withEnabled(enabled); + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceInner.java new file mode 100644 index 0000000000000..ed5c445337869 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupResourceInner.java @@ -0,0 +1,318 @@ +/** + * 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.v2018_03_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_03_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.VoiceReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.LogicAppReceiver; +import com.microsoft.azure.management.monitor.v2018_03_01.AzureFunctionReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An action group resource. + */ +@JsonFlatten +public class ActionGroupResourceInner extends Resource { + /** + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "properties.groupShortName", required = true) + private String groupShortName; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its receivers will receive communications. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "properties.emailReceivers") + private List emailReceivers; + + /** + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "properties.smsReceivers") + private List smsReceivers; + + /** + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "properties.webhookReceivers") + private List webhookReceivers; + + /** + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "properties.itsmReceivers") + private List itsmReceivers; + + /** + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureAppPushReceivers") + private List azureAppPushReceivers; + + /** + * The list of AutomationRunbook receivers that are part of this action + * group. + */ + @JsonProperty(value = "properties.automationRunbookReceivers") + private List automationRunbookReceivers; + + /** + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "properties.voiceReceivers") + private List voiceReceivers; + + /** + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "properties.logicAppReceivers") + private List logicAppReceivers; + + /** + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureFunctionReceivers") + private List azureFunctionReceivers; + + /** + * Get the short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of email receivers that are part of this action group. + * + * @return the emailReceivers value + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the list of AutomationRunbook receivers that are part of this action group. + * + * @return the automationRunbookReceivers value + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the list of AutomationRunbook receivers that are part of this action group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + + /** + * Get the list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsImpl.java new file mode 100644 index 0000000000000..e7ade94db4086 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsImpl.java @@ -0,0 +1,144 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroupResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ActionGroupsImpl extends GroupableResourcesCoreImpl implements ActionGroups { + protected ActionGroupsImpl(MonitorManager manager) { + super(manager.inner().actionGroups(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ActionGroupsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ActionGroupResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + ActionGroupsInner client = this.inner(); + return client.enableReceiverAsync(resourceGroupName, actionGroupName, receiverName).toCompletable(); + } + + @Override + protected ActionGroupResourceImpl wrapModel(ActionGroupResourceInner inner) { + return new ActionGroupResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected ActionGroupResourceImpl wrapModel(String name) { + return new ActionGroupResourceImpl(name, new ActionGroupResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsInner.java new file mode 100644 index 0000000000000..6a09b8b20a672 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/ActionGroupsInner.java @@ -0,0 +1,723 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroupPatchBody; +import com.microsoft.azure.management.monitor.v2018_03_01.EnableRequest; +import com.microsoft.azure.management.monitor.v2018_03_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActionGroups. + */ +public class ActionGroupsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActionGroupsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActionGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActionGroupsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActionGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActionGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ActionGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Body ActionGroupResourceInner actionGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBody actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups enableReceiver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") + Observable> enableReceiver(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body EnableRequest enableRequest, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner createOrUpdate(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).toBlocking().single().body(); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup), serviceCallback); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (actionGroup == null) { + throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(actionGroup); + return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String actionGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String actionGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).toBlocking().single().body(); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch), serviceCallback); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (actionGroupPatch == null) { + throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); + } + Validator.validate(actionGroupPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, this.client.apiVersion(), actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableReceiver(String resourceGroupName, String actionGroupName, String receiverName) { + enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).toBlocking().single().body(); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName), serviceCallback); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + return enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableReceiverWithServiceResponseAsync(String resourceGroupName, String actionGroupName, String receiverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (receiverName == null) { + throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); + } + EnableRequest enableRequest = new EnableRequest(); + enableRequest.withReceiverName(receiverName); + return service.enableReceiver(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), enableRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableReceiverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableReceiverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/IdParsingUtils.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..1166d2d990c93 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2018_03_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceImpl.java new file mode 100644 index 0000000000000..c3abc7fafef21 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceImpl.java @@ -0,0 +1,218 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertResourcePatch; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertCriteria; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertAction; +import rx.functions.Func1; + +class MetricAlertResourceImpl extends GroupableResourceCoreImpl implements MetricAlertResource, MetricAlertResource.Definition, MetricAlertResource.Update { + private MetricAlertResourcePatch updateParameter; + MetricAlertResourceImpl(String name, MetricAlertResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new MetricAlertResourcePatch(); + } + + @Override + public Observable createResourceAsync() { + MetricAlertsInner client = this.manager().inner().metricAlerts(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public MetricAlertResourceInner call(MetricAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MetricAlertsInner client = this.manager().inner().metricAlerts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public MetricAlertResourceInner call(MetricAlertResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MetricAlertsInner client = this.manager().inner().metricAlerts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new MetricAlertResourcePatch(); + } + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public Boolean autoMitigate() { + return this.inner().autoMitigate(); + } + + @Override + public MetricAlertCriteria criteria() { + return this.inner().criteria(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public Period evaluationFrequency() { + return this.inner().evaluationFrequency(); + } + + @Override + public DateTime lastUpdatedTime() { + return this.inner().lastUpdatedTime(); + } + + @Override + public List scopes() { + return this.inner().scopes(); + } + + @Override + public int severity() { + return this.inner().severity(); + } + + @Override + public String targetResourceRegion() { + return this.inner().targetResourceRegion(); + } + + @Override + public String targetResourceType() { + return this.inner().targetResourceType(); + } + + @Override + public Period windowSize() { + return this.inner().windowSize(); + } + + @Override + public MetricAlertResourceImpl withCriteria(MetricAlertCriteria criteria) { + this.inner().withCriteria(criteria); + return this; + } + + @Override + public MetricAlertResourceImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public MetricAlertResourceImpl withEnabled(boolean enabled) { + this.inner().withEnabled(enabled); + return this; + } + + @Override + public MetricAlertResourceImpl withEvaluationFrequency(Period evaluationFrequency) { + this.inner().withEvaluationFrequency(evaluationFrequency); + return this; + } + + @Override + public MetricAlertResourceImpl withSeverity(int severity) { + this.inner().withSeverity(severity); + return this; + } + + @Override + public MetricAlertResourceImpl withWindowSize(Period windowSize) { + this.inner().withWindowSize(windowSize); + return this; + } + + @Override + public MetricAlertResourceImpl withActions(List actions) { + if (isInCreateMode()) { + this.inner().withActions(actions); + } else { + this.updateParameter.withActions(actions); + } + return this; + } + + @Override + public MetricAlertResourceImpl withAutoMitigate(Boolean autoMitigate) { + if (isInCreateMode()) { + this.inner().withAutoMitigate(autoMitigate); + } else { + this.updateParameter.withAutoMitigate(autoMitigate); + } + return this; + } + + @Override + public MetricAlertResourceImpl withScopes(List scopes) { + if (isInCreateMode()) { + this.inner().withScopes(scopes); + } else { + this.updateParameter.withScopes(scopes); + } + return this; + } + + @Override + public MetricAlertResourceImpl withTargetResourceRegion(String targetResourceRegion) { + if (isInCreateMode()) { + this.inner().withTargetResourceRegion(targetResourceRegion); + } else { + this.updateParameter.withTargetResourceRegion(targetResourceRegion); + } + return this; + } + + @Override + public MetricAlertResourceImpl withTargetResourceType(String targetResourceType) { + if (isInCreateMode()) { + this.inner().withTargetResourceType(targetResourceType); + } else { + this.updateParameter.withTargetResourceType(targetResourceType); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceInner.java new file mode 100644 index 0000000000000..242181ba1d2b1 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertResourceInner.java @@ -0,0 +1,333 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import java.util.List; +import org.joda.time.Period; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertCriteria; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertAction; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The metric alert resource. + */ +@JsonFlatten +public class MetricAlertResourceInner extends Resource { + /** + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description", required = true) + private String description; + + /** + * Alert severity {0, 1, 2, 3, 4}. + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /** + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /** + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.evaluationFrequency", required = true) + private Period evaluationFrequency; + + /** + * the period of time (in ISO 8601 duration format) that is used to monitor + * alert activity based on the threshold. + */ + @JsonProperty(value = "properties.windowSize", required = true) + private Period windowSize; + + /** + * the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceType") + private String targetResourceType; + + /** + * the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceRegion") + private String targetResourceRegion; + + /** + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria", required = true) + private MetricAlertCriteria criteria; + + /** + * the flag that indicates whether the alert should be auto resolved or + * not. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /** + * the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved. + */ + @JsonProperty(value = "properties.actions") + private List actions; + + /** + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Get the description of the metric alert that will be included in the alert email. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value + */ + public int severity() { + return this.severity; + } + + /** + * Set alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @return the evaluationFrequency value + */ + public Period evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set how often the metric alert is evaluated represented in ISO 8601 duration format. + * + * @param evaluationFrequency the evaluationFrequency value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEvaluationFrequency(Period evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @return the windowSize value + */ + public Period windowSize() { + return this.windowSize; + } + + /** + * Set the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * + * @param windowSize the windowSize value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withWindowSize(Period windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get defines the specific alert criteria information. + * + * @return the criteria value + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set defines the specific alert criteria information. + * + * @param criteria the criteria value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the flag that indicates whether the alert should be auto resolved or not. + * + * @return the autoMitigate value + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the flag that indicates whether the alert should be auto resolved or not. + * + * @param autoMitigate the autoMitigate value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Set the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. + * + * @param actions the actions value to set + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionImpl.java new file mode 100644 index 0000000000000..90c11afbc368d --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionImpl.java @@ -0,0 +1,40 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertStatusCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertStatus; + +class MetricAlertStatusCollectionImpl extends WrapperImpl implements MetricAlertStatusCollection { + private final MonitorManager manager; + private String resourceGroupName; + private String ruleName; + private String statusName; + + MetricAlertStatusCollectionImpl(MetricAlertStatusCollectionInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionInner.java new file mode 100644 index 0000000000000..b9b10683e547a --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertStatusCollectionInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a collection of alert rule resources. + */ +public class MetricAlertStatusCollectionInner { + /** + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the values for the alert rule resources. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the values for the alert rule resources. + * + * @param value the value value to set + * @return the MetricAlertStatusCollectionInner object itself. + */ + public MetricAlertStatusCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsImpl.java new file mode 100644 index 0000000000000..914dcba7e1c0c --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class MetricAlertsImpl extends GroupableResourcesCoreImpl implements MetricAlerts { + protected MetricAlertsImpl(MonitorManager manager) { + super(manager.inner().metricAlerts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + MetricAlertsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + MetricAlertsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + MetricAlertsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + MetricAlertsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public MetricAlertResource call(MetricAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + MetricAlertsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + MetricAlertsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public MetricAlertResource call(MetricAlertResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public MetricAlertResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected MetricAlertResourceImpl wrapModel(MetricAlertResourceInner inner) { + return new MetricAlertResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected MetricAlertResourceImpl wrapModel(String name) { + return new MetricAlertResourceImpl(name, new MetricAlertResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsInner.java new file mode 100644 index 0000000000000..7bb226a1f4174 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsInner.java @@ -0,0 +1,622 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.monitor.v2018_03_01.ErrorResponseException; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlerts. + */ +public class MetricAlertsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlerts to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourceInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body MetricAlertResourcePatch parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<MetricAlertResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner createOrUpdate(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertResourceInner object if successful. + */ + public MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, MetricAlertResourceInner>() { + @Override + public MetricAlertResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusImpl.java new file mode 100644 index 0000000000000..079fd576b453d --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusImpl.java @@ -0,0 +1,58 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertsStatus; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertStatusCollection; + +class MetricAlertsStatusImpl extends WrapperImpl implements MetricAlertsStatus { + private final MonitorManager manager; + + MetricAlertsStatusImpl(MonitorManager manager) { + super(manager.inner().metricAlertsStatus()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + private MetricAlertStatusCollectionImpl wrapModel(MetricAlertStatusCollectionInner inner) { + return new MetricAlertStatusCollectionImpl(inner, manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String ruleName) { + MetricAlertsStatusInner client = this.inner(); + return client.listAsync(resourceGroupName, ruleName) + .map(new Func1() { + @Override + public MetricAlertStatusCollection call(MetricAlertStatusCollectionInner inner) { + return new MetricAlertStatusCollectionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByNameAsync(String resourceGroupName, String ruleName, String statusName) { + MetricAlertsStatusInner client = this.inner(); + return client.listByNameAsync(resourceGroupName, ruleName, statusName) + .map(new Func1() { + @Override + public MetricAlertStatusCollection call(MetricAlertStatusCollectionInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusInner.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusInner.java new file mode 100644 index 0000000000000..abac247850803 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MetricAlertsStatusInner.java @@ -0,0 +1,243 @@ +/** + * 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.v2018_03_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_03_01.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricAlertsStatus. + */ +public class MetricAlertsStatusInner { + /** The Retrofit service to perform REST calls. */ + private MetricAlertsStatusService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricAlertsStatusInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricAlertsStatusInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricAlertsStatusService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricAlertsStatus to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricAlertsStatusService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertsStatus list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertsStatus listByName" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}") + Observable> listByName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Path("statusName") String statusName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner list(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listAsync(String resourceGroupName, String ruleName) { + return listWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MetricAlertStatusCollectionInner object if successful. + */ + public MetricAlertStatusCollectionInner listByName(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).toBlocking().single().body(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByNameAsync(String resourceGroupName, String ruleName, String statusName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName), serviceCallback); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable listByNameAsync(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithServiceResponseAsync(resourceGroupName, ruleName, statusName).map(new Func1, MetricAlertStatusCollectionInner>() { + @Override + public MetricAlertStatusCollectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MetricAlertStatusCollectionInner object + */ + public Observable> listByNameWithServiceResponseAsync(String resourceGroupName, String ruleName, String statusName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (statusName == null) { + throw new IllegalArgumentException("Parameter statusName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByName(this.client.subscriptionId(), resourceGroupName, ruleName, statusName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManagementClientImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManagementClientImpl.java new file mode 100644 index 0000000000000..59312162a7240 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,224 @@ +/** + * 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.v2018_03_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The MetricAlertsInner object to access its operations. + */ + private MetricAlertsInner metricAlerts; + + /** + * Gets the MetricAlertsInner object to access its operations. + * @return the MetricAlertsInner object. + */ + public MetricAlertsInner metricAlerts() { + return this.metricAlerts; + } + + /** + * The MetricAlertsStatusInner object to access its operations. + */ + private MetricAlertsStatusInner metricAlertsStatus; + + /** + * Gets the MetricAlertsStatusInner object to access its operations. + * @return the MetricAlertsStatusInner object. + */ + public MetricAlertsStatusInner metricAlertsStatus() { + return this.metricAlertsStatus; + } + + /** + * The ActionGroupsInner object to access its operations. + */ + private ActionGroupsInner actionGroups; + + /** + * Gets the ActionGroupsInner object to access its operations. + * @return the ActionGroupsInner object. + */ + public ActionGroupsInner actionGroups() { + return this.actionGroups; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-03-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.metricAlerts = new MetricAlertsInner(restClient().retrofit(), this); + this.metricAlertsStatus = new MetricAlertsStatusInner(restClient().retrofit(), this); + this.actionGroups = new ActionGroupsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorManagementClient", "2018-03-01"); + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManager.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManager.java new file mode 100644 index 0000000000000..e83f86761f13d --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/MonitorManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlerts; +import com.microsoft.azure.management.monitor.v2018_03_01.MetricAlertsStatus; +import com.microsoft.azure.management.monitor.v2018_03_01.ActionGroups; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private MetricAlerts metricAlerts; + private MetricAlertsStatus metricAlertsStatus; + private ActionGroups actionGroups; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage MetricAlerts. + */ + public MetricAlerts metricAlerts() { + if (this.metricAlerts == null) { + this.metricAlerts = new MetricAlertsImpl(this); + } + return this.metricAlerts; + } + + /** + * @return Entry point to manage MetricAlertsStatus. + */ + public MetricAlertsStatus metricAlertsStatus() { + if (this.metricAlertsStatus == null) { + this.metricAlertsStatus = new MetricAlertsStatusImpl(this); + } + return this.metricAlertsStatus; + } + + /** + * @return Entry point to manage ActionGroups. + */ + public ActionGroups actionGroups() { + if (this.actionGroups == null) { + this.actionGroups = new ActionGroupsImpl(this); + } + return this.actionGroups; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/PageImpl.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..1f7e8431c59e1 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/package-info.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/package-info.java new file mode 100644 index 0000000000000..2d1a80b3bda7c --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_03_01.implementation; diff --git a/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/package-info.java b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/package-info.java new file mode 100644 index 0000000000000..f8fc316c0c567 --- /dev/null +++ b/monitor/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_03_01; diff --git a/monitor/resource-manager/v2018_04_16/pom.xml b/monitor/resource-manager/v2018_04_16/pom.xml new file mode 100644 index 0000000000000..ce83f93705d46 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2018_04_16 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Action.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Action.java new file mode 100644 index 0000000000000..f233d1e527da4 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Action.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonSubTypes; + +/** + * Action descriptor. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Action") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction", value = AlertingAction.class), + @JsonSubTypes.Type(name = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction", value = LogToMetricAction.class) +}) +public class Action { +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertSeverity.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertSeverity.java new file mode 100644 index 0000000000000..71cbdc6ab964b --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertingAction.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AlertingAction.java new file mode 100644 index 0000000000000..9d68c7acde3fe --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specify action need to be taken when rule type is Alert. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction") +public class AlertingAction extends Action { + /** + * Severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + */ + @JsonProperty(value = "severity", required = true) + private AlertSeverity severity; + + /** + * Azure action group reference. + */ + @JsonProperty(value = "aznsAction") + private AzNsActionGroup aznsAction; + + /** + * time (in minutes) for which Alerts should be throttled or suppressed. + */ + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; + + /** + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + * + * @return the severity value + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set severity of the alert. Possible values include: '0', '1', '2', '3', '4'. + * + * @param severity the severity value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get azure action group reference. + * + * @return the aznsAction value + */ + public AzNsActionGroup aznsAction() { + return this.aznsAction; + } + + /** + * Set azure action group reference. + * + * @param aznsAction the aznsAction value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { + this.aznsAction = aznsAction; + return this; + } + + /** + * Get time (in minutes) for which Alerts should be throttled or suppressed. + * + * @return the throttlingInMin value + */ + public Integer throttlingInMin() { + return this.throttlingInMin; + } + + /** + * Set time (in minutes) for which Alerts should be throttled or suppressed. + * + * @param throttlingInMin the throttlingInMin value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; + return this; + } + + /** + * Get the trigger condition that results in the alert rule being. + * + * @return the trigger value + */ + public TriggerCondition trigger() { + return this.trigger; + } + + /** + * Set the trigger condition that results in the alert rule being. + * + * @param trigger the trigger value to set + * @return the AlertingAction object itself. + */ + public AlertingAction withTrigger(TriggerCondition trigger) { + this.trigger = trigger; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AzNsActionGroup.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/AzNsActionGroup.java new file mode 100644 index 0000000000000..1509864fc0fa6 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Azure action group. + */ +public class AzNsActionGroup { + /** + * Azure Action Group reference. + */ + @JsonProperty(value = "actionGroup") + private List actionGroup; + + /** + * Custom subject override for all email ids in Azure action group. + */ + @JsonProperty(value = "emailSubject") + private String emailSubject; + + /** + * Custom payload to be sent for all webhook URI in Azure action group. + */ + @JsonProperty(value = "customWebhookPayload") + private String customWebhookPayload; + + /** + * Get azure Action Group reference. + * + * @return the actionGroup value + */ + public List actionGroup() { + return this.actionGroup; + } + + /** + * Set azure Action Group reference. + * + * @param actionGroup the actionGroup value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withActionGroup(List actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + /** + * Get custom subject override for all email ids in Azure action group. + * + * @return the emailSubject value + */ + public String emailSubject() { + return this.emailSubject; + } + + /** + * Set custom subject override for all email ids in Azure action group. + * + * @param emailSubject the emailSubject value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withEmailSubject(String emailSubject) { + this.emailSubject = emailSubject; + return this; + } + + /** + * Get custom payload to be sent for all webhook URI in Azure action group. + * + * @return the customWebhookPayload value + */ + public String customWebhookPayload() { + return this.customWebhookPayload; + } + + /** + * Set custom payload to be sent for all webhook URI in Azure action group. + * + * @param customWebhookPayload the customWebhookPayload value to set + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withCustomWebhookPayload(String customWebhookPayload) { + this.customWebhookPayload = customWebhookPayload; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ConditionalOperator.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ConditionalOperator.java new file mode 100644 index 0000000000000..9d3e477b0c2ca --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Criteria.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Criteria.java new file mode 100644 index 0000000000000..8ade8917e5df5 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Criteria.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the criteria for converting log to metric. + */ +public class Criteria { + /** + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /** + * List of Dimensions for creating metric. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get name of the metric. + * + * @return the metricName value + */ + public String metricName() { + return this.metricName; + } + + /** + * Set name of the metric. + * + * @param metricName the metricName value to set + * @return the Criteria object itself. + */ + public Criteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get list of Dimensions for creating metric. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set list of Dimensions for creating metric. + * + * @param dimensions the dimensions value to set + * @return the Criteria object itself. + */ + public Criteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Dimension.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Dimension.java new file mode 100644 index 0000000000000..2880a4cd6b5dd --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Dimension.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the criteria for converting log to metric. + */ +public class Dimension { + /** + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Operator for dimension values. + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /** + * List of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * Creates an instance of Dimension class. + * @param name name of the dimension. + * @param values list of dimension values. + */ + public Dimension() { + operator = "Include"; + } + + /** + * Get name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the dimension. + * + * @param name the name value to set + * @return the Dimension object itself. + */ + public Dimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get operator for dimension values. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set operator for dimension values. + * + * @param operator the operator value to set + * @return the Dimension object itself. + */ + public Dimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get list of dimension values. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set list of dimension values. + * + * @param values the values value to set + * @return the Dimension object itself. + */ + public Dimension withValues(List values) { + this.values = values; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Enabled.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Enabled.java new file mode 100644 index 0000000000000..259613cf21bed --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponse.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponse.java new file mode 100644 index 0000000000000..cb37b2cb8d6a9 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponseException.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponseException.java new file mode 100644 index 0000000000000..697d60f2e8ebf --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogMetricTrigger.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogMetricTrigger.java new file mode 100644 index 0000000000000..53b7e7875ee9f --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogMetricTrigger.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A log metrics trigger descriptor. + */ +public class LogMetricTrigger { + /** + * Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator") + private ConditionalOperator thresholdOperator; + + /** + * The threshold of the metric trigger. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /** + * Metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: + * 'Consecutive', 'Total'. + */ + @JsonProperty(value = "metricTriggerType") + private MetricTriggerType metricTriggerType; + + /** + * Evaluation of metric on a particular column. + */ + @JsonProperty(value = "metricColumn") + private String metricColumn; + + /** + * Get evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold of the metric trigger. + * + * @return the threshold value + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold of the metric trigger. + * + * @param threshold the threshold value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'. + * + * @return the metricTriggerType value + */ + public MetricTriggerType metricTriggerType() { + return this.metricTriggerType; + } + + /** + * Set metric Trigger Type - 'Consecutive' or 'Total'. Possible values include: 'Consecutive', 'Total'. + * + * @param metricTriggerType the metricTriggerType value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricTriggerType(MetricTriggerType metricTriggerType) { + this.metricTriggerType = metricTriggerType; + return this; + } + + /** + * Get evaluation of metric on a particular column. + * + * @return the metricColumn value + */ + public String metricColumn() { + return this.metricColumn; + } + + /** + * Set evaluation of metric on a particular column. + * + * @param metricColumn the metricColumn value to set + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricColumn(String metricColumn) { + this.metricColumn = metricColumn; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResource.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResource.java new file mode 100644 index 0000000000000..0ca2c5c87fc97 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResource.java @@ -0,0 +1,176 @@ +/** + * 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.v2018_04_16; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_04_16.implementation.MonitorManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_04_16.implementation.LogSearchRuleResourceInner; + +/** + * Type representing LogSearchRuleResource. + */ +public interface LogSearchRuleResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the action value. + */ + Action action(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + Enabled enabled(); + + /** + * @return the lastUpdatedTime value. + */ + DateTime lastUpdatedTime(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the schedule value. + */ + Schedule schedule(); + + /** + * @return the source value. + */ + Source source(); + + /** + * The entirety of the LogSearchRuleResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithAction, DefinitionStages.WithSource, DefinitionStages.WithCreate { + } + + /** + * Grouping of LogSearchRuleResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LogSearchRuleResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the LogSearchRuleResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the logsearchruleresource definition allowing to specify Action. + */ + interface WithAction { + /** + * Specifies action. + * @param action Action needs to be taken on rule execution + * @return the next definition stage +*/ + WithSource withAction(Action action); + } + + /** + * The stage of the logsearchruleresource definition allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source Data Source against which rule will Query Data + * @return the next definition stage +*/ + WithCreate withSource(Source source); + } + + /** + * The stage of the logsearchruleresource definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the Log Search rule + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the logsearchruleresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false' + * @return the next definition stage + */ + WithCreate withEnabled(Enabled enabled); + } + + /** + * The stage of the logsearchruleresource definition allowing to specify Schedule. + */ + interface WithSchedule { + /** + * Specifies schedule. + * @param schedule Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction + * @return the next definition stage + */ + WithCreate withSchedule(Schedule schedule); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithDescription, DefinitionStages.WithEnabled, DefinitionStages.WithSchedule { + } + } + /** + * The template for a LogSearchRuleResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of LogSearchRuleResource update stages. + */ + interface UpdateStages { + /** + * The stage of the logsearchruleresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled The flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false' + * @return the next update stage + */ + Update withEnabled(Enabled enabled); + } + + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResourcePatch.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResourcePatch.java new file mode 100644 index 0000000000000..b065fd51361a6 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogSearchRuleResourcePatch.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The log search rule resource for patch operations. + */ +@JsonFlatten +public class LogSearchRuleResourcePatch { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogToMetricAction.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogToMetricAction.java new file mode 100644 index 0000000000000..7123320364a43 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/LogToMetricAction.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Specify action need to be taken when rule type is converting log to metric. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction") +public class LogToMetricAction extends Action { + /** + * Criteria of Metric. + */ + @JsonProperty(value = "criteria", required = true) + private List criteria; + + /** + * Get criteria of Metric. + * + * @return the criteria value + */ + public List criteria() { + return this.criteria; + } + + /** + * Set criteria of Metric. + * + * @param criteria the criteria value to set + * @return the LogToMetricAction object itself. + */ + public LogToMetricAction withCriteria(List criteria) { + this.criteria = criteria; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/MetricTriggerType.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/MetricTriggerType.java new file mode 100644 index 0000000000000..d29716f16132b --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ProvisioningState.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ProvisioningState.java new file mode 100644 index 0000000000000..3f2db8c1dffc0 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/QueryType.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/QueryType.java new file mode 100644 index 0000000000000..92aaec6a1c204 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +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/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Schedule.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Schedule.java new file mode 100644 index 0000000000000..367a3a507620b --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines how often to run the search and the time interval. + */ +public class Schedule { + /** + * frequency (in minutes) at which rule condition should be evaluated. + */ + @JsonProperty(value = "frequencyInMinutes", required = true) + private int frequencyInMinutes; + + /** + * Time window for which data needs to be fetched for query (should be + * greater than or equal to frequencyInMinutes). + */ + @JsonProperty(value = "timeWindowInMinutes", required = true) + private int timeWindowInMinutes; + + /** + * Get frequency (in minutes) at which rule condition should be evaluated. + * + * @return the frequencyInMinutes value + */ + public int frequencyInMinutes() { + return this.frequencyInMinutes; + } + + /** + * Set frequency (in minutes) at which rule condition should be evaluated. + * + * @param frequencyInMinutes the frequencyInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withFrequencyInMinutes(int frequencyInMinutes) { + this.frequencyInMinutes = frequencyInMinutes; + return this; + } + + /** + * Get time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). + * + * @return the timeWindowInMinutes value + */ + public int timeWindowInMinutes() { + return this.timeWindowInMinutes; + } + + /** + * Set time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). + * + * @param timeWindowInMinutes the timeWindowInMinutes value to set + * @return the Schedule object itself. + */ + public Schedule withTimeWindowInMinutes(int timeWindowInMinutes) { + this.timeWindowInMinutes = timeWindowInMinutes; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ScheduledQueryRules.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ScheduledQueryRules.java new file mode 100644 index 0000000000000..0f166946e50c9 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/ScheduledQueryRules.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.monitor.v2018_04_16.implementation.ScheduledQueryRulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ScheduledQueryRules. + */ +public interface ScheduledQueryRules extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Source.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Source.java new file mode 100644 index 0000000000000..2f1f967ccebc5 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/Source.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifies the log search query. + */ +public class Source { + /** + * Log search query. Required for action type - AlertingAction. + */ + @JsonProperty(value = "query") + private String query; + + /** + * List of Resource referred into query. + */ + @JsonProperty(value = "authorizedResources") + private List authorizedResources; + + /** + * The resource uri over which log search query is to be run. + */ + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; + + /** + * Set value to 'ResultCount'. Possible values include: 'ResultCount'. + */ + @JsonProperty(value = "queryType") + private QueryType queryType; + + /** + * Get log search query. Required for action type - AlertingAction. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set log search query. Required for action type - AlertingAction. + * + * @param query the query value to set + * @return the Source object itself. + */ + public Source withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get list of Resource referred into query. + * + * @return the authorizedResources value + */ + public List authorizedResources() { + return this.authorizedResources; + } + + /** + * Set list of Resource referred into query. + * + * @param authorizedResources the authorizedResources value to set + * @return the Source object itself. + */ + public Source withAuthorizedResources(List authorizedResources) { + this.authorizedResources = authorizedResources; + return this; + } + + /** + * Get the resource uri over which log search query is to be run. + * + * @return the dataSourceId value + */ + public String dataSourceId() { + return this.dataSourceId; + } + + /** + * Set the resource uri over which log search query is to be run. + * + * @param dataSourceId the dataSourceId value to set + * @return the Source object itself. + */ + public Source withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; + return this; + } + + /** + * Get set value to 'ResultCount'. Possible values include: 'ResultCount'. + * + * @return the queryType value + */ + public QueryType queryType() { + return this.queryType; + } + + /** + * Set set value to 'ResultCount'. Possible values include: 'ResultCount'. + * + * @param queryType the queryType value to set + * @return the Source object itself. + */ + public Source withQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/TriggerCondition.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/TriggerCondition.java new file mode 100644 index 0000000000000..ce097c5d7267e --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/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.v2018_04_16; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The condition that results in the Log Search rule. + */ +public class TriggerCondition { + /** + * Evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible + * values include: 'GreaterThan', 'LessThan', 'Equal'. + */ + @JsonProperty(value = "thresholdOperator", required = true) + private ConditionalOperator thresholdOperator; + + /** + * Result or count threshold based on which rule should be triggered. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** + * Trigger condition for metric query rule. + */ + @JsonProperty(value = "metricTrigger") + private LogMetricTrigger metricTrigger; + + /** + * Get evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @return the thresholdOperator value + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set evaluation operation for rule - 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', 'LessThan', 'Equal'. + * + * @param thresholdOperator the thresholdOperator value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get result or count threshold based on which rule should be triggered. + * + * @return the threshold value + */ + public double threshold() { + return this.threshold; + } + + /** + * Set result or count threshold based on which rule should be triggered. + * + * @param threshold the threshold value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get trigger condition for metric query rule. + * + * @return the metricTrigger value + */ + public LogMetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set trigger condition for metric query rule. + * + * @param metricTrigger the metricTrigger value to set + * @return the TriggerCondition object itself. + */ + public TriggerCondition withMetricTrigger(LogMetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/IdParsingUtils.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..40cce73971225 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2018_04_16.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceImpl.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceImpl.java new file mode 100644 index 0000000000000..0e552cf4c84c8 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceImpl.java @@ -0,0 +1,142 @@ +/** + * 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.v2018_04_16.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2018_04_16.LogSearchRuleResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_04_16.LogSearchRuleResourcePatch; +import com.microsoft.azure.management.monitor.v2018_04_16.Enabled; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_04_16.ProvisioningState; +import com.microsoft.azure.management.monitor.v2018_04_16.Source; +import com.microsoft.azure.management.monitor.v2018_04_16.Schedule; +import com.microsoft.azure.management.monitor.v2018_04_16.Action; +import rx.functions.Func1; + +class LogSearchRuleResourceImpl extends GroupableResourceCoreImpl implements LogSearchRuleResource, LogSearchRuleResource.Definition, LogSearchRuleResource.Update { + private LogSearchRuleResourcePatch updateParameter; + LogSearchRuleResourceImpl(String name, LogSearchRuleResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new LogSearchRuleResourcePatch(); + } + + @Override + public Observable createResourceAsync() { + ScheduledQueryRulesInner client = this.manager().inner().scheduledQueryRules(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public LogSearchRuleResourceInner call(LogSearchRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ScheduledQueryRulesInner client = this.manager().inner().scheduledQueryRules(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public LogSearchRuleResourceInner call(LogSearchRuleResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ScheduledQueryRulesInner client = this.manager().inner().scheduledQueryRules(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new LogSearchRuleResourcePatch(); + } + + @Override + public Action action() { + return this.inner().action(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Enabled enabled() { + return this.inner().enabled(); + } + + @Override + public DateTime lastUpdatedTime() { + return this.inner().lastUpdatedTime(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Schedule schedule() { + return this.inner().schedule(); + } + + @Override + public Source source() { + return this.inner().source(); + } + + @Override + public LogSearchRuleResourceImpl withAction(Action action) { + this.inner().withAction(action); + return this; + } + + @Override + public LogSearchRuleResourceImpl withSource(Source source) { + this.inner().withSource(source); + return this; + } + + @Override + public LogSearchRuleResourceImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public LogSearchRuleResourceImpl withSchedule(Schedule schedule) { + this.inner().withSchedule(schedule); + return this; + } + + @Override + public LogSearchRuleResourceImpl withEnabled(Enabled enabled) { + if (isInCreateMode()) { + this.inner().withEnabled(enabled); + } else { + this.updateParameter.withEnabled(enabled); + } + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceInner.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceInner.java new file mode 100644 index 0000000000000..5a5db2c497cfd --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/LogSearchRuleResourceInner.java @@ -0,0 +1,189 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16.implementation; + +import com.microsoft.azure.management.monitor.v2018_04_16.Enabled; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_04_16.ProvisioningState; +import com.microsoft.azure.management.monitor.v2018_04_16.Source; +import com.microsoft.azure.management.monitor.v2018_04_16.Schedule; +import com.microsoft.azure.management.monitor.v2018_04_16.Action; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The Log Search Rule resource. + */ +@JsonFlatten +public class LogSearchRuleResourceInner extends Resource { + /** + * The description of the Log Search rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. Possible values include: 'true', 'false'. + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastUpdatedTime; + + /** + * Provisioning state of the scheduled query rule. Possible values include: + * 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Data Source against which rule will Query Data. + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /** + * Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction. + */ + @JsonProperty(value = "properties.schedule") + private Schedule schedule; + + /** + * Action needs to be taken on rule execution. + */ + @JsonProperty(value = "properties.action", required = true) + private Action action; + + /** + * Get the description of the Log Search rule. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the Log Search rule. + * + * @param description the description value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @return the enabled value + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the flag which indicates whether the Log Search rule is enabled. Value should be true or false. Possible values include: 'true', 'false'. + * + * @param enabled the enabled value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get last time the rule was updated in IS08601 format. + * + * @return the lastUpdatedTime value + */ + public DateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get provisioning state of the scheduled query rule. Possible values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get data Source against which rule will Query Data. + * + * @return the source value + */ + public Source source() { + return this.source; + } + + /** + * Set data Source against which rule will Query Data. + * + * @param source the source value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSource(Source source) { + this.source = source; + return this; + } + + /** + * Get schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @return the schedule value + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @param schedule the schedule value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get action needs to be taken on rule execution. + * + * @return the action value + */ + public Action action() { + return this.action; + } + + /** + * Set action needs to be taken on rule execution. + * + * @param action the action value to set + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAction(Action action) { + this.action = action; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorClientImpl.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorClientImpl.java new file mode 100644 index 0000000000000..53558dcdcce27 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorClientImpl.java @@ -0,0 +1,196 @@ +/** + * 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.v2018_04_16.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorClientImpl class. + */ +public class MonitorClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * 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 MonitorClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-04-16"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.scheduledQueryRules = new ScheduledQueryRulesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorClient", "2018-04-16"); + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorManager.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorManager.java new file mode 100644 index 0000000000000..6862fb2ee39e3 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/MonitorManager.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2018_04_16.ScheduledQueryRules; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private ScheduledQueryRules scheduledQueryRules; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ScheduledQueryRules. + */ + public ScheduledQueryRules scheduledQueryRules() { + if (this.scheduledQueryRules == null) { + this.scheduledQueryRules = new ScheduledQueryRulesImpl(this); + } + return this.scheduledQueryRules; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/PageImpl.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/PageImpl.java new file mode 100644 index 0000000000000..e110aab1e9808 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_04_16.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesImpl.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesImpl.java new file mode 100644 index 0000000000000..75287087e8550 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2018_04_16.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2018_04_16.ScheduledQueryRules; +import com.microsoft.azure.management.monitor.v2018_04_16.LogSearchRuleResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ScheduledQueryRulesImpl extends GroupableResourcesCoreImpl implements ScheduledQueryRules { + protected ScheduledQueryRulesImpl(MonitorManager manager) { + super(manager.inner().scheduledQueryRules(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ScheduledQueryRulesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ScheduledQueryRulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ScheduledQueryRulesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ScheduledQueryRulesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public LogSearchRuleResource call(LogSearchRuleResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ScheduledQueryRulesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ScheduledQueryRulesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public LogSearchRuleResource call(LogSearchRuleResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public LogSearchRuleResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected LogSearchRuleResourceImpl wrapModel(LogSearchRuleResourceInner inner) { + return new LogSearchRuleResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected LogSearchRuleResourceImpl wrapModel(String name) { + return new LogSearchRuleResourceImpl(name, new LogSearchRuleResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesInner.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesInner.java new file mode 100644 index 0000000000000..620db6dd4ecf8 --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/ScheduledQueryRulesInner.java @@ -0,0 +1,787 @@ +/** + * 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.v2018_04_16.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_04_16.ErrorResponseException; +import com.microsoft.azure.management.monitor.v2018_04_16.LogSearchRuleResourcePatch; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ScheduledQueryRules. + */ +public class ScheduledQueryRulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ScheduledQueryRulesService service; + /** The service client containing this operation class. */ + private MonitorClientImpl 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, MonitorClientImpl 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.v2018_04_16.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.v2018_04_16.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.v2018_04_16.ScheduledQueryRules update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("ruleName") String ruleName, @Query("api-version") String apiVersion, @Body LogSearchRuleResourcePatch parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_04_16.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.v2018_04_16.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.v2018_04_16.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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LogSearchRuleResourceInner object if successful. + */ + public LogSearchRuleResourceInner update(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).toBlocking().single().body(); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters), serviceCallback); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, ruleName, parameters).map(new Func1, LogSearchRuleResourceInner>() { + @Override + public LogSearchRuleResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LogSearchRuleResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.subscriptionId(), resourceGroupName, ruleName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String ruleName) { + deleteWithServiceResponseAsync(resourceGroupName, ruleName).toBlocking().single().body(); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String ruleName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, ruleName), serviceCallback); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithServiceResponseAsync(resourceGroupName, ruleName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String ruleName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (ruleName == null) { + throw new IllegalArgumentException("Parameter ruleName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, ruleName, this.client.subscriptionId(), this.client.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() { + PageImpl page = new PageImpl<>(); + 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) { + PageImpl page = new PageImpl<>(); + 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList list(String filter) { + PageImpl page = new PageImpl<>(); + 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) { + PageImpl page = new PageImpl<>(); + 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + 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) { + PageImpl page = new PageImpl<>(); + 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName, String filter) { + PageImpl page = new PageImpl<>(); + 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) { + PageImpl page = new PageImpl<>(); + 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/package-info.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/package-info.java new file mode 100644 index 0000000000000..93cf769338c0d --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_04_16.implementation; diff --git a/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/package-info.java b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/package-info.java new file mode 100644 index 0000000000000..8cf324d1c486a --- /dev/null +++ b/monitor/resource-manager/v2018_04_16/src/main/java/com/microsoft/azure/management/monitor/v2018_04_16/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_04_16; diff --git a/monitor/resource-manager/v2018_09_01/pom.xml b/monitor/resource-manager/v2018_09_01/pom.xml new file mode 100644 index 0000000000000..fdafc39b6640f --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.monitor.v2018_09_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-monitor + 1.0.0-beta + jar + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Monitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupPatchBody.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupPatchBody.java new file mode 100644 index 0000000000000..cc76f1b6c7de0 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupPatchBody.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An action group object for the body of patch operations. + */ +@JsonFlatten +public class ActionGroupPatchBody { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupResource.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupResource.java new file mode 100644 index 0000000000000..e8dbd866e612c --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroupResource.java @@ -0,0 +1,285 @@ +/** + * 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.v2018_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.MonitorManager; +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.ActionGroupResourceInner; + +/** + * Type representing ActionGroupResource. + */ +public interface ActionGroupResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the armRoleReceivers value. + */ + List armRoleReceivers(); + + /** + * @return the automationRunbookReceivers value. + */ + List automationRunbookReceivers(); + + /** + * @return the azureAppPushReceivers value. + */ + List azureAppPushReceivers(); + + /** + * @return the azureFunctionReceivers value. + */ + List azureFunctionReceivers(); + + /** + * @return the emailReceivers value. + */ + List emailReceivers(); + + /** + * @return the enabled value. + */ + boolean enabled(); + + /** + * @return the groupShortName value. + */ + String groupShortName(); + + /** + * @return the itsmReceivers value. + */ + List itsmReceivers(); + + /** + * @return the logicAppReceivers value. + */ + List logicAppReceivers(); + + /** + * @return the smsReceivers value. + */ + List smsReceivers(); + + /** + * @return the voiceReceivers value. + */ + List voiceReceivers(); + + /** + * @return the webhookReceivers value. + */ + List webhookReceivers(); + + /** + * The entirety of the ActionGroupResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithEnabled, DefinitionStages.WithGroupShortName, DefinitionStages.WithCreate { + } + + /** + * Grouping of ActionGroupResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ActionGroupResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the ActionGroupResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the actiongroupresource definition allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications + * @return the next definition stage +*/ + WithGroupShortName withEnabled(boolean enabled); + } + + /** + * The stage of the actiongroupresource definition allowing to specify GroupShortName. + */ + interface WithGroupShortName { + /** + * Specifies groupShortName. + * @param groupShortName The short name of the action group. This will be used in SMS messages + * @return the next definition stage +*/ + WithCreate withGroupShortName(String groupShortName); + } + + /** + * The stage of the actiongroupresource definition allowing to specify ArmRoleReceivers. + */ + interface WithArmRoleReceivers { + /** + * Specifies armRoleReceivers. + * @param armRoleReceivers The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported + * @return the next definition stage + */ + WithCreate withArmRoleReceivers(List armRoleReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AutomationRunbookReceivers. + */ + interface WithAutomationRunbookReceivers { + /** + * Specifies automationRunbookReceivers. + * @param automationRunbookReceivers The list of AutomationRunbook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAutomationRunbookReceivers(List automationRunbookReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AzureAppPushReceivers. + */ + interface WithAzureAppPushReceivers { + /** + * Specifies azureAppPushReceivers. + * @param azureAppPushReceivers The list of AzureAppPush receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAzureAppPushReceivers(List azureAppPushReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify AzureFunctionReceivers. + */ + interface WithAzureFunctionReceivers { + /** + * Specifies azureFunctionReceivers. + * @param azureFunctionReceivers The list of azure function receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withAzureFunctionReceivers(List azureFunctionReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify EmailReceivers. + */ + interface WithEmailReceivers { + /** + * Specifies emailReceivers. + * @param emailReceivers The list of email receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withEmailReceivers(List emailReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify ItsmReceivers. + */ + interface WithItsmReceivers { + /** + * Specifies itsmReceivers. + * @param itsmReceivers The list of ITSM receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withItsmReceivers(List itsmReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify LogicAppReceivers. + */ + interface WithLogicAppReceivers { + /** + * Specifies logicAppReceivers. + * @param logicAppReceivers The list of logic app receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withLogicAppReceivers(List logicAppReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify SmsReceivers. + */ + interface WithSmsReceivers { + /** + * Specifies smsReceivers. + * @param smsReceivers The list of SMS receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withSmsReceivers(List smsReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify VoiceReceivers. + */ + interface WithVoiceReceivers { + /** + * Specifies voiceReceivers. + * @param voiceReceivers The list of voice receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withVoiceReceivers(List voiceReceivers); + } + + /** + * The stage of the actiongroupresource definition allowing to specify WebhookReceivers. + */ + interface WithWebhookReceivers { + /** + * Specifies webhookReceivers. + * @param webhookReceivers The list of webhook receivers that are part of this action group + * @return the next definition stage + */ + WithCreate withWebhookReceivers(List webhookReceivers); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithArmRoleReceivers, DefinitionStages.WithAutomationRunbookReceivers, DefinitionStages.WithAzureAppPushReceivers, DefinitionStages.WithAzureFunctionReceivers, DefinitionStages.WithEmailReceivers, DefinitionStages.WithItsmReceivers, DefinitionStages.WithLogicAppReceivers, DefinitionStages.WithSmsReceivers, DefinitionStages.WithVoiceReceivers, DefinitionStages.WithWebhookReceivers { + } + } + /** + * The template for a ActionGroupResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithEnabled { + } + + /** + * Grouping of ActionGroupResource update stages. + */ + interface UpdateStages { + /** + * The stage of the actiongroupresource update allowing to specify Enabled. + */ + interface WithEnabled { + /** + * Specifies enabled. + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated + * @return the next update stage + */ + Update withEnabled(Boolean enabled); + } + + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroups.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroups.java new file mode 100644 index 0000000000000..b3f0bc6fbfd1d --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ActionGroups.java @@ -0,0 +1,37 @@ +/** + * 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.v2018_09_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.ActionGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ActionGroups. + */ +public interface ActionGroups extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName); + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ArmRoleReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ArmRoleReceiver.java new file mode 100644 index 0000000000000..0e27be0b947aa --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ArmRoleReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An arm role receiver. + */ +public class ArmRoleReceiver { + /** + * The name of the arm role receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The arm role id. + */ + @JsonProperty(value = "roleId", required = true) + private String roleId; + + /** + * Get the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the arm role receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the arm role id. + * + * @return the roleId value + */ + public String roleId() { + return this.roleId; + } + + /** + * Set the arm role id. + * + * @param roleId the roleId value to set + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withRoleId(String roleId) { + this.roleId = roleId; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AutomationRunbookReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AutomationRunbookReceiver.java new file mode 100644 index 0000000000000..ccf62ce8db8ab --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AutomationRunbookReceiver.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Automation Runbook notification receiver. + */ +public class AutomationRunbookReceiver { + /** + * The Azure automation account Id which holds this runbook and + * authenticate to Azure resource. + */ + @JsonProperty(value = "automationAccountId", required = true) + private String automationAccountId; + + /** + * The name for this runbook. + */ + @JsonProperty(value = "runbookName", required = true) + private String runbookName; + + /** + * The resource id for webhook linked to this runbook. + */ + @JsonProperty(value = "webhookResourceId", required = true) + private String webhookResourceId; + + /** + * Indicates whether this instance is global runbook. + */ + @JsonProperty(value = "isGlobalRunbook", required = true) + private boolean isGlobalRunbook; + + /** + * Indicates name of the webhook. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /** + * Get the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @return the automationAccountId value + */ + public String automationAccountId() { + return this.automationAccountId; + } + + /** + * Set the Azure automation account Id which holds this runbook and authenticate to Azure resource. + * + * @param automationAccountId the automationAccountId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withAutomationAccountId(String automationAccountId) { + this.automationAccountId = automationAccountId; + return this; + } + + /** + * Get the name for this runbook. + * + * @return the runbookName value + */ + public String runbookName() { + return this.runbookName; + } + + /** + * Set the name for this runbook. + * + * @param runbookName the runbookName value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withRunbookName(String runbookName) { + this.runbookName = runbookName; + return this; + } + + /** + * Get the resource id for webhook linked to this runbook. + * + * @return the webhookResourceId value + */ + public String webhookResourceId() { + return this.webhookResourceId; + } + + /** + * Set the resource id for webhook linked to this runbook. + * + * @param webhookResourceId the webhookResourceId value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withWebhookResourceId(String webhookResourceId) { + this.webhookResourceId = webhookResourceId; + return this; + } + + /** + * Get indicates whether this instance is global runbook. + * + * @return the isGlobalRunbook value + */ + public boolean isGlobalRunbook() { + return this.isGlobalRunbook; + } + + /** + * Set indicates whether this instance is global runbook. + * + * @param isGlobalRunbook the isGlobalRunbook value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withIsGlobalRunbook(boolean isGlobalRunbook) { + this.isGlobalRunbook = isGlobalRunbook; + return this; + } + + /** + * Get indicates name of the webhook. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set indicates name of the webhook. + * + * @param name the name value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureAppPushReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureAppPushReceiver.java new file mode 100644 index 0000000000000..748b04c84421f --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureAppPushReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure mobile App push notification receiver. + */ +public class AzureAppPushReceiver { + /** + * The name of the Azure mobile app push receiver. Names must be unique + * across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * Get the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address registered for the Azure mobile app. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureFunctionReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureFunctionReceiver.java new file mode 100644 index 0000000000000..ef32a0e7f37b3 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/AzureFunctionReceiver.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An azure function receiver. + */ +public class AzureFunctionReceiver { + /** + * The name of the azure function receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the function app. + */ + @JsonProperty(value = "functionAppResourceId", required = true) + private String functionAppResourceId; + + /** + * The function name in the function app. + */ + @JsonProperty(value = "functionName", required = true) + private String functionName; + + /** + * The http trigger url where http request sent to. + */ + @JsonProperty(value = "httpTriggerUrl", required = true) + private String httpTriggerUrl; + + /** + * Get the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the azure function receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the function app. + * + * @return the functionAppResourceId value + */ + public String functionAppResourceId() { + return this.functionAppResourceId; + } + + /** + * Set the azure resource id of the function app. + * + * @param functionAppResourceId the functionAppResourceId value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionAppResourceId(String functionAppResourceId) { + this.functionAppResourceId = functionAppResourceId; + return this; + } + + /** + * Get the function name in the function app. + * + * @return the functionName value + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the function name in the function app. + * + * @param functionName the functionName value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the http trigger url where http request sent to. + * + * @return the httpTriggerUrl value + */ + public String httpTriggerUrl() { + return this.httpTriggerUrl; + } + + /** + * Set the http trigger url where http request sent to. + * + * @param httpTriggerUrl the httpTriggerUrl value to set + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withHttpTriggerUrl(String httpTriggerUrl) { + this.httpTriggerUrl = httpTriggerUrl; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineMetadataValue.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineMetadataValue.java new file mode 100644 index 0000000000000..961cb3fe7b652 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineMetadataValue.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents a baseline metadata value. + */ +public class BaselineMetadataValue { + /** + * The name of the metadata. + */ + @JsonProperty(value = "name") + private LocalizableString name; + + /** + * The value of the metadata. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name of the metadata. + * + * @return the name value + */ + public LocalizableString name() { + return this.name; + } + + /** + * Set the name of the metadata. + * + * @param name the name value to set + * @return the BaselineMetadataValue object itself. + */ + public BaselineMetadataValue withName(LocalizableString name) { + this.name = name; + return this; + } + + /** + * Get the value of the metadata. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value of the metadata. + * + * @param value the value value to set + * @return the BaselineMetadataValue object itself. + */ + public BaselineMetadataValue withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineResponse.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineResponse.java new file mode 100644 index 0000000000000..e86f06955d34b --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/BaselineResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.MonitorManager; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.BaselineResponseInner; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.BaselineInner; +import java.util.List; +import org.joda.time.Period; +import org.joda.time.DateTime; + +/** + * Type representing BaselineResponse. + */ +public interface BaselineResponse extends HasInner, HasManager { + /** + * @return the aggregation value. + */ + String aggregation(); + + /** + * @return the baseline value. + */ + List baseline(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the interval value. + */ + Period interval(); + + /** + * @return the metadata value. + */ + List metadata(); + + /** + * @return the name value. + */ + LocalizableString name(); + + /** + * @return the timespan value. + */ + String timespan(); + + /** + * @return the timestamps value. + */ + List timestamps(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Baselines.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Baselines.java new file mode 100644 index 0000000000000..dbfc73f2ef7e9 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Baselines.java @@ -0,0 +1,28 @@ +/** + * 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.v2018_09_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.BaselinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Baselines. + */ +public interface Baselines extends HasInner { + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri); + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/CalculateBaselineResponse.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/CalculateBaselineResponse.java new file mode 100644 index 0000000000000..886d85f8657af --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/CalculateBaselineResponse.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.v2018_09_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.MonitorManager; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.CalculateBaselineResponseInner; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.BaselineInner; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing CalculateBaselineResponse. + */ +public interface CalculateBaselineResponse extends HasInner, HasManager { + /** + * @return the baseline value. + */ + List baseline(); + + /** + * @return the timestamps value. + */ + List timestamps(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EmailReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EmailReceiver.java new file mode 100644 index 0000000000000..1eeb31375397b --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EmailReceiver.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An email receiver. + */ +public class EmailReceiver { + /** + * The name of the email receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** + * The receiver status of the e-mail. Possible values include: + * 'NotSpecified', 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the email receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the email address of this receiver. + * + * @return the emailAddress value + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the email address of this receiver. + * + * @param emailAddress the emailAddress value to set + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the receiver status of the e-mail. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EnableRequest.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EnableRequest.java new file mode 100644 index 0000000000000..3da4cbe49b856 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/EnableRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a receiver that should be resubscribed. + */ +public class EnableRequest { + /** + * The name of the receiver to resubscribe. + */ + @JsonProperty(value = "receiverName", required = true) + private String receiverName; + + /** + * Get the name of the receiver to resubscribe. + * + * @return the receiverName value + */ + public String receiverName() { + return this.receiverName; + } + + /** + * Set the name of the receiver to resubscribe. + * + * @param receiverName the receiverName value to set + * @return the EnableRequest object itself. + */ + public EnableRequest withReceiverName(String receiverName) { + this.receiverName = receiverName; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponse.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponse.java new file mode 100644 index 0000000000000..01f90b3c12def --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponse.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponseException.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponseException.java new file mode 100644 index 0000000000000..8d89f28a3ea03 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ItsmReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ItsmReceiver.java new file mode 100644 index 0000000000000..003a6a4a9c526 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ItsmReceiver.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Itsm receiver. + */ +public class ItsmReceiver { + /** + * The name of the Itsm receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * OMS LA instance identifier. + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /** + * Unique identification of ITSM connection among multiple defined in above + * workspace. + */ + @JsonProperty(value = "connectionId", required = true) + private String connectionId; + + /** + * JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + */ + @JsonProperty(value = "ticketConfiguration", required = true) + private String ticketConfiguration; + + /** + * Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the Itsm receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get oMS LA instance identifier. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set oMS LA instance identifier. + * + * @param workspaceId the workspaceId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get unique identification of ITSM connection among multiple defined in above workspace. + * + * @return the connectionId value + */ + public String connectionId() { + return this.connectionId; + } + + /** + * Set unique identification of ITSM connection among multiple defined in above workspace. + * + * @param connectionId the connectionId value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withConnectionId(String connectionId) { + this.connectionId = connectionId; + return this; + } + + /** + * Get jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @return the ticketConfiguration value + */ + public String ticketConfiguration() { + return this.ticketConfiguration; + } + + /** + * Set jSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well. + * + * @param ticketConfiguration the ticketConfiguration value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withTicketConfiguration(String ticketConfiguration) { + this.ticketConfiguration = ticketConfiguration; + return this; + } + + /** + * Get region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @param region the region value to set + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LocalizableString.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LocalizableString.java new file mode 100644 index 0000000000000..be80b0f3849a4 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LocalizableString.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The localizable string class. + */ +public class LocalizableString { + /** + * The invariant value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * The locale specific value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the invariant value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the invariant value. + * + * @param value the value value to set + * @return the LocalizableString object itself. + */ + public LocalizableString withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the locale specific value. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the locale specific value. + * + * @param localizedValue the localizedValue value to set + * @return the LocalizableString object itself. + */ + public LocalizableString withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LogicAppReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LogicAppReceiver.java new file mode 100644 index 0000000000000..6b6a4f8f73d00 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/LogicAppReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A logic app receiver. + */ +public class LogicAppReceiver { + /** + * The name of the logic app receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The azure resource id of the logic app receiver. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /** + * The callback url where http request sent to. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /** + * Get the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the logic app receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azure resource id of the logic app receiver. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the azure resource id of the logic app receiver. + * + * @param resourceId the resourceId value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the callback url where http request sent to. + * + * @return the callbackUrl value + */ + public String callbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callback url where http request sent to. + * + * @param callbackUrl the callbackUrl value to set + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/MetricBaselines.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/MetricBaselines.java new file mode 100644 index 0000000000000..098cdd3722cd6 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/MetricBaselines.java @@ -0,0 +1,39 @@ +/** + * 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.v2018_09_01; + +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_09_01.implementation.MetricBaselinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MetricBaselines. + */ +public interface MetricBaselines extends HasInner { + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String metricName); + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation); + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ReceiverStatus.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ReceiverStatus.java new file mode 100644 index 0000000000000..f6fbb94e37206 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ReceiverStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ReceiverStatus. + */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ResultType.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ResultType.java new file mode 100644 index 0000000000000..720c6e810ae9a --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/ResultType.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for ResultType. + */ +public enum ResultType { + /** Enum value Data. */ + DATA("Data"), + + /** Enum value Metadata. */ + METADATA("Metadata"); + + /** The actual serialized value for a ResultType instance. */ + private String value; + + ResultType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResultType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResultType object, or null if unable to parse. + */ + @JsonCreator + public static ResultType fromString(String value) { + ResultType[] items = ResultType.values(); + for (ResultType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Sensitivity.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Sensitivity.java new file mode 100644 index 0000000000000..0def049f4b401 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/Sensitivity.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Sensitivity. + */ +public enum Sensitivity { + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"); + + /** The actual serialized value for a Sensitivity instance. */ + private String value; + + Sensitivity(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Sensitivity instance. + * + * @param value the serialized value to parse. + * @return the parsed Sensitivity object, or null if unable to parse. + */ + @JsonCreator + public static Sensitivity fromString(String value) { + Sensitivity[] items = Sensitivity.values(); + for (Sensitivity item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/SmsReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/SmsReceiver.java new file mode 100644 index 0000000000000..fb1481e613235 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/SmsReceiver.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An SMS receiver. + */ +public class SmsReceiver { + /** + * The name of the SMS receiver. Names must be unique across all receivers + * within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * The status of the receiver. Possible values include: 'NotSpecified', + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** + * Get the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SMS receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the SMS receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the SMS receiver. + * + * @param countryCode the countryCode value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the SMS receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status of the receiver. Possible values include: 'NotSpecified', 'Enabled', 'Disabled'. + * + * @return the status value + */ + public ReceiverStatus status() { + return this.status; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/TimeSeriesInformation.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/TimeSeriesInformation.java new file mode 100644 index 0000000000000..750d148f4a99a --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/TimeSeriesInformation.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The time series info needed for calculating the baseline. + */ +public class TimeSeriesInformation { + /** + * The list of sensitivities for calculating the baseline. + */ + @JsonProperty(value = "sensitivities", required = true) + private List sensitivities; + + /** + * The metric values to calculate the baseline. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * The array of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps") + private List timestamps; + + /** + * Get the list of sensitivities for calculating the baseline. + * + * @return the sensitivities value + */ + public List sensitivities() { + return this.sensitivities; + } + + /** + * Set the list of sensitivities for calculating the baseline. + * + * @param sensitivities the sensitivities value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withSensitivities(List sensitivities) { + this.sensitivities = sensitivities; + return this; + } + + /** + * Get the metric values to calculate the baseline. + * + * @return the values value + */ + public List values() { + return this.values; + } + + /** + * Set the metric values to calculate the baseline. + * + * @param values the values value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the TimeSeriesInformation object itself. + */ + public TimeSeriesInformation withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/VoiceReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/VoiceReceiver.java new file mode 100644 index 0000000000000..37053e324e1f9 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/VoiceReceiver.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A voice receiver. + */ +public class VoiceReceiver { + /** + * The name of the voice receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the voice receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the country code of the voice receiver. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the country code of the voice receiver. + * + * @param countryCode the countryCode value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phone number of the voice receiver. + * + * @return the phoneNumber value + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phone number of the voice receiver. + * + * @param phoneNumber the phoneNumber value to set + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/WebhookReceiver.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/WebhookReceiver.java new file mode 100644 index 0000000000000..400c2ec4090bd --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/WebhookReceiver.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A webhook receiver. + */ +public class WebhookReceiver { + /** + * The name of the webhook receiver. Names must be unique across all + * receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /** + * Get the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the webhook receiver. Names must be unique across all receivers within an action group. + * + * @param name the name value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the URI where webhooks should be sent. + * + * @return the serviceUri value + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceImpl.java new file mode 100644 index 0000000000000..3c6dbf7d56db6 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,216 @@ +/** + * 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.v2018_09_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroupResource; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroupPatchBody; +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_09_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.VoiceReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.LogicAppReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AzureFunctionReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.ArmRoleReceiver; +import rx.functions.Func1; + +class ActionGroupResourceImpl extends GroupableResourceCoreImpl implements ActionGroupResource, ActionGroupResource.Definition, ActionGroupResource.Update { + private ActionGroupPatchBody updateParameter; + ActionGroupResourceImpl(String name, ActionGroupResourceInner inner, MonitorManager manager) { + super(name, inner, manager); + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public Observable createResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ActionGroupResourceInner call(ActionGroupResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ActionGroupsInner client = this.manager().inner().actionGroups(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ActionGroupPatchBody(); + } + + @Override + public List armRoleReceivers() { + return this.inner().armRoleReceivers(); + } + + @Override + public List automationRunbookReceivers() { + return this.inner().automationRunbookReceivers(); + } + + @Override + public List azureAppPushReceivers() { + return this.inner().azureAppPushReceivers(); + } + + @Override + public List azureFunctionReceivers() { + return this.inner().azureFunctionReceivers(); + } + + @Override + public List emailReceivers() { + return this.inner().emailReceivers(); + } + + @Override + public boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String groupShortName() { + return this.inner().groupShortName(); + } + + @Override + public List itsmReceivers() { + return this.inner().itsmReceivers(); + } + + @Override + public List logicAppReceivers() { + return this.inner().logicAppReceivers(); + } + + @Override + public List smsReceivers() { + return this.inner().smsReceivers(); + } + + @Override + public List voiceReceivers() { + return this.inner().voiceReceivers(); + } + + @Override + public List webhookReceivers() { + return this.inner().webhookReceivers(); + } + + @Override + public ActionGroupResourceImpl withEnabled(boolean enabled) { + this.inner().withEnabled(enabled); + return this; + } + + @Override + public ActionGroupResourceImpl withGroupShortName(String groupShortName) { + this.inner().withGroupShortName(groupShortName); + return this; + } + + @Override + public ActionGroupResourceImpl withArmRoleReceivers(List armRoleReceivers) { + this.inner().withArmRoleReceivers(armRoleReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.inner().withAutomationRunbookReceivers(automationRunbookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAzureAppPushReceivers(List azureAppPushReceivers) { + this.inner().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withAzureFunctionReceivers(List azureFunctionReceivers) { + this.inner().withAzureFunctionReceivers(azureFunctionReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEmailReceivers(List emailReceivers) { + this.inner().withEmailReceivers(emailReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withItsmReceivers(List itsmReceivers) { + this.inner().withItsmReceivers(itsmReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withLogicAppReceivers(List logicAppReceivers) { + this.inner().withLogicAppReceivers(logicAppReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withSmsReceivers(List smsReceivers) { + this.inner().withSmsReceivers(smsReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withVoiceReceivers(List voiceReceivers) { + this.inner().withVoiceReceivers(voiceReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withWebhookReceivers(List webhookReceivers) { + this.inner().withWebhookReceivers(webhookReceivers); + return this; + } + + @Override + public ActionGroupResourceImpl withEnabled(Boolean enabled) { + this.updateParameter.withEnabled(enabled); + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceInner.java new file mode 100644 index 0000000000000..1ee25549762b1 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupResourceInner.java @@ -0,0 +1,346 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import java.util.List; +import com.microsoft.azure.management.monitor.v2018_09_01.EmailReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.SmsReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.WebhookReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.ItsmReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AzureAppPushReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AutomationRunbookReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.VoiceReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.LogicAppReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.AzureFunctionReceiver; +import com.microsoft.azure.management.monitor.v2018_09_01.ArmRoleReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An action group resource. + */ +@JsonFlatten +public class ActionGroupResourceInner extends Resource { + /** + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "properties.groupShortName", required = true) + private String groupShortName; + + /** + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its receivers will receive communications. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /** + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "properties.emailReceivers") + private List emailReceivers; + + /** + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "properties.smsReceivers") + private List smsReceivers; + + /** + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "properties.webhookReceivers") + private List webhookReceivers; + + /** + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "properties.itsmReceivers") + private List itsmReceivers; + + /** + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureAppPushReceivers") + private List azureAppPushReceivers; + + /** + * The list of AutomationRunbook receivers that are part of this action + * group. + */ + @JsonProperty(value = "properties.automationRunbookReceivers") + private List automationRunbookReceivers; + + /** + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "properties.voiceReceivers") + private List voiceReceivers; + + /** + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "properties.logicAppReceivers") + private List logicAppReceivers; + + /** + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureFunctionReceivers") + private List azureFunctionReceivers; + + /** + * The list of ARM role receivers that are part of this action group. Roles + * are Azure RBAC roles and only built-in roles are supported. + */ + @JsonProperty(value = "properties.armRoleReceivers") + private List armRoleReceivers; + + /** + * Get the short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the list of email receivers that are part of this action group. + * + * @return the emailReceivers value + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the list of AutomationRunbook receivers that are part of this action group. + * + * @return the automationRunbookReceivers value + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the list of AutomationRunbook receivers that are part of this action group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + + /** + * Get the list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + + /** + * Get the list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + * + * @return the armRoleReceivers value + */ + public List armRoleReceivers() { + return this.armRoleReceivers; + } + + /** + * Set the list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported. + * + * @param armRoleReceivers the armRoleReceivers value to set + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsImpl.java new file mode 100644 index 0000000000000..5ffeabd49b89c --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsImpl.java @@ -0,0 +1,144 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroupResource; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ActionGroupsImpl extends GroupableResourcesCoreImpl implements ActionGroups { + protected ActionGroupsImpl(MonitorManager manager) { + super(manager.inner().actionGroups(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ActionGroupsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ActionGroupsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ActionGroupsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ActionGroupsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ActionGroupResource call(ActionGroupResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ActionGroupResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + ActionGroupsInner client = this.inner(); + return client.enableReceiverAsync(resourceGroupName, actionGroupName, receiverName).toCompletable(); + } + + @Override + protected ActionGroupResourceImpl wrapModel(ActionGroupResourceInner inner) { + return new ActionGroupResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected ActionGroupResourceImpl wrapModel(String name) { + return new ActionGroupResourceImpl(name, new ActionGroupResourceInner(), this.manager()); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsInner.java new file mode 100644 index 0000000000000..c9f48d7d0a148 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/ActionGroupsInner.java @@ -0,0 +1,723 @@ +/** + * 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.v2018_09_01.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroupPatchBody; +import com.microsoft.azure.management.monitor.v2018_09_01.EnableRequest; +import com.microsoft.azure.management.monitor.v2018_09_01.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ActionGroups. + */ +public class ActionGroupsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ActionGroupsService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of ActionGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ActionGroupsInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(ActionGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ActionGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ActionGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Body ActionGroupResourceInner actionGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Query("api-version") String apiVersion, @Body ActionGroupPatchBody actionGroupPatch, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups list" }) + @GET("subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups enableReceiver" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe") + Observable> enableReceiver(@Path("resourceGroupName") String resourceGroupName, @Path("actionGroupName") String actionGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body EnableRequest enableRequest, @Header("User-Agent") String userAgent); + + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner createOrUpdate(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).toBlocking().single().body(); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup), serviceCallback); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroup).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (actionGroup == null) { + throw new IllegalArgumentException("Parameter actionGroup is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(actionGroup); + return service.createOrUpdate(resourceGroupName, actionGroupName, this.client.subscriptionId(), actionGroup, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String actionGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).toBlocking().single().body(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String actionGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, actionGroupName), serviceCallback); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String actionGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, actionGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String actionGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ActionGroupResourceInner object if successful. + */ + public ActionGroupResourceInner update(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).toBlocking().single().body(); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch), serviceCallback); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable updateAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithServiceResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch).map(new Func1, ActionGroupResourceInner>() { + @Override + public ActionGroupResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ActionGroupResourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (actionGroupPatch == null) { + throw new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null."); + } + Validator.validate(actionGroupPatch); + return service.update(this.client.subscriptionId(), resourceGroupName, actionGroupName, this.client.apiVersion(), actionGroupPatch, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a subscription. + * + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @return the observable to the List<ActionGroupResourceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableReceiver(String resourceGroupName, String actionGroupName, String receiverName) { + enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).toBlocking().single().body(); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName), serviceCallback); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableReceiverAsync(String resourceGroupName, String actionGroupName, String receiverName) { + return enableReceiverWithServiceResponseAsync(resourceGroupName, actionGroupName, receiverName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @param actionGroupName The name of the action group. + * @param receiverName The name of the receiver to resubscribe. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableReceiverWithServiceResponseAsync(String resourceGroupName, String actionGroupName, String receiverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (actionGroupName == null) { + throw new IllegalArgumentException("Parameter actionGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (receiverName == null) { + throw new IllegalArgumentException("Parameter receiverName is required and cannot be null."); + } + EnableRequest enableRequest = new EnableRequest(); + enableRequest.withReceiverName(receiverName); + return service.enableReceiver(resourceGroupName, actionGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), enableRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableReceiverDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableReceiverDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(409, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineInner.java new file mode 100644 index 0000000000000..09d70f9038ac9 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineInner.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.management.monitor.v2018_09_01.Sensitivity; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The baseline values for a single sensitivity value. + */ +public class BaselineInner { + /** + * The sensitivity of the baseline. Possible values include: 'Low', + * 'Medium', 'High'. + */ + @JsonProperty(value = "sensitivity", required = true) + private Sensitivity sensitivity; + + /** + * The low thresholds of the baseline. + */ + @JsonProperty(value = "lowThresholds", required = true) + private List lowThresholds; + + /** + * The high thresholds of the baseline. + */ + @JsonProperty(value = "highThresholds", required = true) + private List highThresholds; + + /** + * Get the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @return the sensitivity value + */ + public Sensitivity sensitivity() { + return this.sensitivity; + } + + /** + * Set the sensitivity of the baseline. Possible values include: 'Low', 'Medium', 'High'. + * + * @param sensitivity the sensitivity value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withSensitivity(Sensitivity sensitivity) { + this.sensitivity = sensitivity; + return this; + } + + /** + * Get the low thresholds of the baseline. + * + * @return the lowThresholds value + */ + public List lowThresholds() { + return this.lowThresholds; + } + + /** + * Set the low thresholds of the baseline. + * + * @param lowThresholds the lowThresholds value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withLowThresholds(List lowThresholds) { + this.lowThresholds = lowThresholds; + return this; + } + + /** + * Get the high thresholds of the baseline. + * + * @return the highThresholds value + */ + public List highThresholds() { + return this.highThresholds; + } + + /** + * Set the high thresholds of the baseline. + * + * @param highThresholds the highThresholds value to set + * @return the BaselineInner object itself. + */ + public BaselineInner withHighThresholds(List highThresholds) { + this.highThresholds = highThresholds; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseImpl.java new file mode 100644 index 0000000000000..81a1f4b2401c4 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.management.monitor.v2018_09_01.BaselineResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import org.joda.time.Period; +import com.microsoft.azure.management.monitor.v2018_09_01.BaselineMetadataValue; +import com.microsoft.azure.management.monitor.v2018_09_01.LocalizableString; +import org.joda.time.DateTime; + +class BaselineResponseImpl extends WrapperImpl implements BaselineResponse { + private final MonitorManager manager; + BaselineResponseImpl(BaselineResponseInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + @Override + public String aggregation() { + return this.inner().aggregation(); + } + + @Override + public List baseline() { + return this.inner().baseline(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Period interval() { + return this.inner().interval(); + } + + @Override + public List metadata() { + return this.inner().metadata(); + } + + @Override + public LocalizableString name() { + return this.inner().name(); + } + + @Override + public String timespan() { + return this.inner().timespan(); + } + + @Override + public List timestamps() { + return this.inner().timestamps(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseInner.java new file mode 100644 index 0000000000000..e231c4dd9e6b4 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselineResponseInner.java @@ -0,0 +1,231 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.management.monitor.v2018_09_01.LocalizableString; +import org.joda.time.Period; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.monitor.v2018_09_01.BaselineMetadataValue; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The response to a baseline query. + */ +@JsonFlatten +public class BaselineResponseInner { + /** + * The metric baseline ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The resource type of the baseline resource. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The name and the display name of the metric, i.e. it is localizable + * string. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableString name; + + /** + * The timespan for which the data was retrieved. Its value consists of two + * datetimes concatenated, separated by '/'. This may be adjusted in the + * future and returned back from what was originally requested. + */ + @JsonProperty(value = "properties.timespan") + private String timespan; + + /** + * The interval (window size) for which the metric data was returned in. + * This may be adjusted in the future and returned back from what was + * originally requested. This is not present if a metadata request was + * made. + */ + @JsonProperty(value = "properties.interval") + private Period interval; + + /** + * The aggregation type of the metric. + */ + @JsonProperty(value = "properties.aggregation") + private String aggregation; + + /** + * The array of timestamps of the baselines. + */ + @JsonProperty(value = "properties.timestamps") + private List timestamps; + + /** + * The baseline values for each sensitivity. + */ + @JsonProperty(value = "properties.baseline") + private List baseline; + + /** + * The baseline metadata values. + */ + @JsonProperty(value = "properties.metadata") + private List metadata; + + /** + * Get the metric baseline ID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the resource type of the baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the name and the display name of the metric, i.e. it is localizable string. + * + * @return the name value + */ + public LocalizableString name() { + return this.name; + } + + /** + * Get the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @return the timespan value + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. + * + * @param timespan the timespan value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @return the interval value + */ + public Period interval() { + return this.interval; + } + + /** + * Set the interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. + * + * @param interval the interval value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withInterval(Period interval) { + this.interval = interval; + return this; + } + + /** + * Get the aggregation type of the metric. + * + * @return the aggregation value + */ + public String aggregation() { + return this.aggregation; + } + + /** + * Set the aggregation type of the metric. + * + * @param aggregation the aggregation value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withAggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the baseline values for each sensitivity. + * + * @return the baseline value + */ + public List baseline() { + return this.baseline; + } + + /** + * Set the baseline values for each sensitivity. + * + * @param baseline the baseline value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withBaseline(List baseline) { + this.baseline = baseline; + return this; + } + + /** + * Get the baseline metadata values. + * + * @return the metadata value + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the baseline metadata values. + * + * @param metadata the metadata value to set + * @return the BaselineResponseInner object itself. + */ + public BaselineResponseInner withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesImpl.java new file mode 100644 index 0000000000000..be625610ffcb1 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesImpl.java @@ -0,0 +1,42 @@ +/** + * 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. + * abc + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2018_09_01.Baselines; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_09_01.BaselineResponse; + +class BaselinesImpl extends WrapperImpl implements Baselines { + private final MonitorManager manager; + + BaselinesImpl(MonitorManager manager) { + super(manager.inner().baselines()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceUri) { + BaselinesInner client = this.inner(); + return client.getAsync(resourceUri) + .map(new Func1() { + @Override + public BaselineResponse call(BaselineResponseInner inner) { + return new BaselineResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesInner.java new file mode 100644 index 0000000000000..a44adea8efa19 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/BaselinesInner.java @@ -0,0 +1,247 @@ +/** + * 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.v2018_09_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_09_01.ErrorResponseException; +import com.microsoft.azure.management.monitor.v2018_09_01.ResultType; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import org.joda.time.Period; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Baselines. + */ +public class BaselinesInner { + /** The Retrofit service to perform REST calls. */ + private BaselinesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of BaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BaselinesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(BaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Baselines to be + * used by Retrofit to perform actually REST calls. + */ + interface BaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.Baselines get" }) + @GET("{resourceUri}/providers/microsoft.insights/baseline") + Observable> get(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("metricnames") String metricnames, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("aggregation") String aggregation, @Query("sensitivities") String sensitivities, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri) { + return getWithServiceResponseAsync(resourceUri).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri), serviceCallback); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri) { + return getWithServiceResponseAsync(resourceUri).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String metricnames = null; + final String timespan = null; + final Period interval = null; + final String aggregation = null; + final String sensitivities = null; + final ResultType resultType = null; + final String metricnamespace = null; + final String filter = null; + return service.get(resourceUri, metricnames, timespan, interval, aggregation, sensitivities, resultType, this.client.apiVersion(), metricnamespace, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri, String metricnames, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + return getWithServiceResponseAsync(resourceUri, metricnames, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String metricnames, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, metricnames, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter), serviceCallback); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri, String metricnames, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + return getWithServiceResponseAsync(resourceUri, metricnames, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricnames The names of the metrics (comma separated) to retrieve. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String metricnames, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, metricnames, timespan, interval, aggregation, sensitivities, resultType, this.client.apiVersion(), metricnamespace, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseImpl.java new file mode 100644 index 0000000000000..739869acfb680 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseImpl.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.management.monitor.v2018_09_01.CalculateBaselineResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import org.joda.time.DateTime; + +class CalculateBaselineResponseImpl extends WrapperImpl implements CalculateBaselineResponse { + private final MonitorManager manager; + CalculateBaselineResponseImpl(CalculateBaselineResponseInner inner, MonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public MonitorManager manager() { + return this.manager; + } + + @Override + public List baseline() { + return this.inner().baseline(); + } + + @Override + public List timestamps() { + return this.inner().timestamps(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseInner.java new file mode 100644 index 0000000000000..8e6aed7eabec3 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/CalculateBaselineResponseInner.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response to a calculate baseline call. + */ +public class CalculateBaselineResponseInner { + /** + * The resource type of the baseline resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The array of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps") + private List timestamps; + + /** + * The baseline values for each sensitivity. + */ + @JsonProperty(value = "baseline", required = true) + private List baseline; + + /** + * Get the resource type of the baseline resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type of the baseline resource. + * + * @param type the type value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the array of timestamps of the baselines. + * + * @return the timestamps value + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the array of timestamps of the baselines. + * + * @param timestamps the timestamps value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the baseline values for each sensitivity. + * + * @return the baseline value + */ + public List baseline() { + return this.baseline; + } + + /** + * Set the baseline values for each sensitivity. + * + * @param baseline the baseline value to set + * @return the CalculateBaselineResponseInner object itself. + */ + public CalculateBaselineResponseInner withBaseline(List baseline) { + this.baseline = baseline; + return this; + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/IdParsingUtils.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..603538d3c292f --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * 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.v2018_09_01.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesImpl.java new file mode 100644 index 0000000000000..ec9100217df97 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesImpl.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.monitor.v2018_09_01.MetricBaselines; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.monitor.v2018_09_01.BaselineResponse; +import com.microsoft.azure.management.monitor.v2018_09_01.CalculateBaselineResponse; +import com.microsoft.azure.management.monitor.v2018_09_01.TimeSeriesInformation; + +class MetricBaselinesImpl extends WrapperImpl implements MetricBaselines { + private final MonitorManager manager; + + MetricBaselinesImpl(MonitorManager manager) { + super(manager.inner().metricBaselines()); + this.manager = manager; + } + + public MonitorManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceUri, String metricName) { + MetricBaselinesInner client = this.inner(); + return client.getAsync(resourceUri, metricName) + .map(new Func1() { + @Override + public BaselineResponse call(BaselineResponseInner inner) { + return new BaselineResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + MetricBaselinesInner client = this.inner(); + return client.calculateBaselineAsync(resourceUri, timeSeriesInformation) + .map(new Func1() { + @Override + public CalculateBaselineResponse call(CalculateBaselineResponseInner inner) { + return new CalculateBaselineResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesInner.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesInner.java new file mode 100644 index 0000000000000..485e33461a6af --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MetricBaselinesInner.java @@ -0,0 +1,348 @@ +/** + * 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.v2018_09_01.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.monitor.v2018_09_01.ErrorResponseException; +import com.microsoft.azure.management.monitor.v2018_09_01.ResultType; +import com.microsoft.azure.management.monitor.v2018_09_01.TimeSeriesInformation; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import org.joda.time.Period; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MetricBaselines. + */ +public class MetricBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private MetricBaselinesService service; + /** The service client containing this operation class. */ + private MonitorManagementClientImpl client; + + /** + * Initializes an instance of MetricBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MetricBaselinesInner(Retrofit retrofit, MonitorManagementClientImpl client) { + this.service = retrofit.create(MetricBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MetricBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface MetricBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.monitor.v2018_09_01.MetricBaselines get" }) + @GET("{resourceUri}/providers/microsoft.insights/baseline/{metricName}") + Observable> get(@Path(value = "resourceUri", encoded = true) String resourceUri, @Path("metricName") String metricName, @Query("timespan") String timespan, @Query("interval") Period interval, @Query("aggregation") String aggregation, @Query("sensitivities") String sensitivities, @Query("resultType") ResultType resultType1, @Query("api-version") String apiVersion, @Query("metricnamespace") String metricnamespace, @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.v2018_09_01.MetricBaselines calculateBaseline" }) + @POST("{resourceUri}/providers/microsoft.insights/calculatebaseline") + Observable> calculateBaseline(@Path(value = "resourceUri", encoded = true) String resourceUri, @Query("api-version") String apiVersion, @Body TimeSeriesInformation timeSeriesInformation, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri, String metricName) { + return getWithServiceResponseAsync(resourceUri, metricName).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String metricName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, metricName), serviceCallback); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri, String metricName) { + return getWithServiceResponseAsync(resourceUri, metricName).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String metricName) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (metricName == null) { + throw new IllegalArgumentException("Parameter metricName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String timespan = null; + final Period interval = null; + final String aggregation = null; + final String sensitivities = null; + final ResultType resultType = null; + final String metricnamespace = null; + final String filter = null; + return service.get(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, this.client.apiVersion(), metricnamespace, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BaselineResponseInner object if successful. + */ + public BaselineResponseInner get(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + return getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter).toBlocking().single().body(); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter), serviceCallback); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable getAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + return getWithServiceResponseAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, metricnamespace, filter).map(new Func1, BaselineResponseInner>() { + @Override + public BaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Gets the baseline values for a specific metric**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param metricName The name of the metric to retrieve the baseline for. + * @param timespan The timespan of the query. It is a string with the following format 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The aggregation type of the metric to retrieve the baseline for. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. Possible values include: 'Data', 'Metadata' + * @param metricnamespace Metric namespace to query metric definitions for. + * @param filter The **$filter** is used to describe a set of dimensions with their concrete values which produce a specific metric's time series, in which a baseline is requested for. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BaselineResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String metricName, String timespan, Period interval, String aggregation, String sensitivities, ResultType resultType, String metricnamespace, String filter) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (metricName == null) { + throw new IllegalArgumentException("Parameter metricName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, this.client.apiVersion(), metricnamespace, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CalculateBaselineResponseInner object if successful. + */ + public CalculateBaselineResponseInner calculateBaseline(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + return calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation).toBlocking().single().body(); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation), serviceCallback); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CalculateBaselineResponseInner object + */ + public Observable calculateBaselineAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + return calculateBaselineWithServiceResponseAsync(resourceUri, timeSeriesInformation).map(new Func1, CalculateBaselineResponseInner>() { + @Override + public CalculateBaselineResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * **Lists the baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. It has the following structure: subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. For example: subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 + * @param timeSeriesInformation Information that need to be specified to calculate a baseline on a time series. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CalculateBaselineResponseInner object + */ + public Observable> calculateBaselineWithServiceResponseAsync(String resourceUri, TimeSeriesInformation timeSeriesInformation) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (timeSeriesInformation == null) { + throw new IllegalArgumentException("Parameter timeSeriesInformation is required and cannot be null."); + } + Validator.validate(timeSeriesInformation); + return service.calculateBaseline(resourceUri, this.client.apiVersion(), timeSeriesInformation, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = calculateBaselineDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse calculateBaselineDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManagementClientImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManagementClientImpl.java new file mode 100644 index 0000000000000..e3d3df5a394ca --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManagementClientImpl.java @@ -0,0 +1,224 @@ +/** + * 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.v2018_09_01.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the MonitorManagementClientImpl class. + */ +public class MonitorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription Id. */ + private String subscriptionId; + + /** + * Gets The Azure subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public MonitorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public MonitorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public MonitorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ActionGroupsInner object to access its operations. + */ + private ActionGroupsInner actionGroups; + + /** + * Gets the ActionGroupsInner object to access its operations. + * @return the ActionGroupsInner object. + */ + public ActionGroupsInner actionGroups() { + return this.actionGroups; + } + + /** + * The MetricBaselinesInner object to access its operations. + */ + private MetricBaselinesInner metricBaselines; + + /** + * Gets the MetricBaselinesInner object to access its operations. + * @return the MetricBaselinesInner object. + */ + public MetricBaselinesInner metricBaselines() { + return this.metricBaselines; + } + + /** + * The BaselinesInner object to access its operations. + */ + private BaselinesInner baselines; + + /** + * Gets the BaselinesInner object to access its operations. + * @return the BaselinesInner object. + */ + public BaselinesInner baselines() { + return this.baselines; + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public MonitorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of MonitorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public MonitorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-09-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.actionGroups = new ActionGroupsInner(restClient().retrofit(), this); + this.metricBaselines = new MetricBaselinesInner(restClient().retrofit(), this); + this.baselines = new BaselinesInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "MonitorManagementClient", "2018-09-01"); + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManager.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManager.java new file mode 100644 index 0000000000000..24ed514bb32a5 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/MonitorManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.monitor.v2018_09_01.ActionGroups; +import com.microsoft.azure.management.monitor.v2018_09_01.MetricBaselines; +import com.microsoft.azure.management.monitor.v2018_09_01.Baselines; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Monitor resource management. + */ +public final class MonitorManager extends ManagerCore { + private ActionGroups actionGroups; + private MetricBaselines metricBaselines; + private Baselines baselines; + /** + * Get a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new MonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new MonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of MonitorManager that exposes Monitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the MonitorManager + */ + public static MonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new MonitorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of MonitorManager that exposes Monitor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Monitor management API entry points that work across subscriptions + */ + MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage ActionGroups. + */ + public ActionGroups actionGroups() { + if (this.actionGroups == null) { + this.actionGroups = new ActionGroupsImpl(this); + } + return this.actionGroups; + } + + /** + * @return Entry point to manage MetricBaselines. + */ + public MetricBaselines metricBaselines() { + if (this.metricBaselines == null) { + this.metricBaselines = new MetricBaselinesImpl(this); + } + return this.metricBaselines; + } + + /** + * @return Entry point to manage Baselines. + */ + public Baselines baselines() { + if (this.baselines == null) { + this.baselines = new BaselinesImpl(this); + } + return this.baselines; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public MonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return MonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private MonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new MonitorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/PageImpl.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/PageImpl.java new file mode 100644 index 0000000000000..761368e8333dc --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/package-info.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/package-info.java new file mode 100644 index 0000000000000..2b0fb98af9a78 --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_09_01.implementation; diff --git a/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/package-info.java b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/package-info.java new file mode 100644 index 0000000000000..95bb84ccd1fdd --- /dev/null +++ b/monitor/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/monitor/v2018_09_01/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for MonitorManagementClient. + * Monitor Management Client. + */ +package com.microsoft.azure.management.monitor.v2018_09_01;