From 1d353fff74663baa0f4484157989522e368d562f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 19 Apr 2018 20:36:08 +0000 Subject: [PATCH 1/4] Generated from 17163e4990a1c6b6e1238bdcf78a15d4e0948130 Updated readme.md to include jobs.json for 2017-03-01-preview where necessary. Regenerated swagger to include job step and target executions, sku name and capacity support in agent createOrUpdate and get, as well as filter for top executions. Job examples were updated to reflect correct json request and response paramters for agent and target group. --- .../azure/management/sql/JobAgentState.java | 50 + .../azure/management/sql/JobAgentUpdate.java | 44 + .../management/sql/JobExecutionLifecycle.java | 65 + .../management/sql/JobExecutionTarget.java | 63 + .../azure/management/sql/JobSchedule.java | 149 ++ .../azure/management/sql/JobScheduleType.java | 53 + .../azure/management/sql/JobStepAction.java | 96 ++ .../management/sql/JobStepActionSource.java | 38 + .../management/sql/JobStepActionType.java | 38 + .../sql/JobStepExecutionOptions.java | 149 ++ .../azure/management/sql/JobStepOutput.java | 227 +++ .../management/sql/JobStepOutputType.java | 38 + .../sql/JobTargetGroupMembershipType.java | 53 + .../azure/management/sql/JobTargetType.java | 50 + .../management/sql/ProvisioningState.java | 50 + .../sql/implementation/JobAgentInner.java | 89 + .../sql/implementation/JobAgentsInner.java | 1119 ++++++++++++ .../implementation/JobCredentialInner.java | 72 + .../implementation/JobCredentialsInner.java | 629 +++++++ .../sql/implementation/JobExecutionInner.java | 234 +++ .../implementation/JobExecutionsInner.java | 1514 +++++++++++++++++ .../sql/implementation/JobInner.java | 87 + .../JobStepExecutionsInner.java | 624 +++++++ .../sql/implementation/JobStepInner.java | 182 ++ .../sql/implementation/JobStepsInner.java | 1032 +++++++++++ .../JobTargetExecutionsInner.java | 1091 ++++++++++++ .../implementation/JobTargetGroupInner.java | 46 + .../implementation/JobTargetGroupsInner.java | 631 +++++++ .../sql/implementation/JobTargetInner.java | 206 +++ .../sql/implementation/JobVersionInner.java | 16 + .../sql/implementation/JobVersionsInner.java | 424 +++++ .../sql/implementation/JobsInner.java | 629 +++++++ .../SqlManagementClientImpl.java | 126 ++ 33 files changed, 9914 insertions(+) create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentState.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionLifecycle.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionTarget.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobSchedule.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobScheduleType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepAction.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionSource.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepExecutionOptions.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutput.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutputType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetGroupMembershipType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ProvisioningState.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepExecutionsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetExecutionsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobsInner.java diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentState.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentState.java new file mode 100644 index 00000000000..c66befdead8 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentState.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobAgentState. + */ +public final class JobAgentState extends ExpandableStringEnum { + /** Static value Creating for JobAgentState. */ + public static final JobAgentState CREATING = fromString("Creating"); + + /** Static value Ready for JobAgentState. */ + public static final JobAgentState READY = fromString("Ready"); + + /** Static value Updating for JobAgentState. */ + public static final JobAgentState UPDATING = fromString("Updating"); + + /** Static value Deleting for JobAgentState. */ + public static final JobAgentState DELETING = fromString("Deleting"); + + /** Static value Disabled for JobAgentState. */ + public static final JobAgentState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a JobAgentState from its string representation. + * @param name a name to look for + * @return the corresponding JobAgentState + */ + @JsonCreator + public static JobAgentState fromString(String name) { + return fromString(name, JobAgentState.class); + } + + /** + * @return known JobAgentState values + */ + public static Collection values() { + return values(JobAgentState.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentUpdate.java new file mode 100644 index 00000000000..f6200ae8bb8 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobAgentUpdate.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.sql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An update to an Azure SQL job agent. + */ +public class JobAgentUpdate { + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the JobAgentUpdate object itself. + */ + public JobAgentUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionLifecycle.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionLifecycle.java new file mode 100644 index 00000000000..ee5e0ef464b --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionLifecycle.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobExecutionLifecycle. + */ +public final class JobExecutionLifecycle extends ExpandableStringEnum { + /** Static value Created for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CREATED = fromString("Created"); + + /** Static value InProgress for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle IN_PROGRESS = fromString("InProgress"); + + /** Static value WaitingForChildJobExecutions for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_CHILD_JOB_EXECUTIONS = fromString("WaitingForChildJobExecutions"); + + /** Static value WaitingForRetry for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle WAITING_FOR_RETRY = fromString("WaitingForRetry"); + + /** Static value Succeeded for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED = fromString("Succeeded"); + + /** Static value SucceededWithSkipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SUCCEEDED_WITH_SKIPPED = fromString("SucceededWithSkipped"); + + /** Static value Failed for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle FAILED = fromString("Failed"); + + /** Static value TimedOut for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle CANCELED = fromString("Canceled"); + + /** Static value Skipped for JobExecutionLifecycle. */ + public static final JobExecutionLifecycle SKIPPED = fromString("Skipped"); + + /** + * Creates or finds a JobExecutionLifecycle from its string representation. + * @param name a name to look for + * @return the corresponding JobExecutionLifecycle + */ + @JsonCreator + public static JobExecutionLifecycle fromString(String name) { + return fromString(name, JobExecutionLifecycle.class); + } + + /** + * @return known JobExecutionLifecycle values + */ + public static Collection values() { + return values(JobExecutionLifecycle.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionTarget.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionTarget.java new file mode 100644 index 00000000000..d31c58fa946 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobExecutionTarget.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The target that a job execution is executed on. + */ +public class JobExecutionTarget { + /** + * The type of the target. Possible values include: 'TargetGroup', + * 'SqlDatabase', 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private JobTargetType type; + + /** + * The server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /** + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /** + * Get the type value. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Get the serverName value. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobSchedule.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobSchedule.java new file mode 100644 index 00000000000..21c6c6cff91 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobSchedule.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Scheduling properties of a job. + */ +public class JobSchedule { + /** + * Schedule start time. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * Schedule end time. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * Schedule interval type. Possible values include: 'Once', 'Recurring'. + */ + @JsonProperty(value = "type") + private JobScheduleType type; + + /** + * Whether or not the schedule is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * Value of the schedule's recurring interval, if the scheduletype is + * recurring. ISO8601 duration format. + */ + @JsonProperty(value = "interval") + private String interval; + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime value. + * + * @param startTime the startTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime value. + * + * @param endTime the endTime value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public JobScheduleType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withType(JobScheduleType type) { + this.type = type; + return this; + } + + /** + * Get the enabled value. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled value. + * + * @param enabled the enabled value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the interval value. + * + * @return the interval value + */ + public String interval() { + return this.interval; + } + + /** + * Set the interval value. + * + * @param interval the interval value to set + * @return the JobSchedule object itself. + */ + public JobSchedule withInterval(String interval) { + this.interval = interval; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobScheduleType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobScheduleType.java new file mode 100644 index 00000000000..16a9e28e193 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobScheduleType.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.sql; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobScheduleType. + */ +public enum JobScheduleType { + /** Enum value Once. */ + ONCE("Once"), + + /** Enum value Recurring. */ + RECURRING("Recurring"); + + /** The actual serialized value for a JobScheduleType instance. */ + private String value; + + JobScheduleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleType object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleType fromString(String value) { + JobScheduleType[] items = JobScheduleType.values(); + for (JobScheduleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepAction.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepAction.java new file mode 100644 index 00000000000..8f27b80cba2 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepAction.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.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The action to be executed by a job step. + */ +public class JobStepAction { + /** + * Type of action being executed by the job step. Possible values include: + * 'TSql'. + */ + @JsonProperty(value = "type") + private JobStepActionType type; + + /** + * The source of the action to execute. Possible values include: 'Inline'. + */ + @JsonProperty(value = "source") + private JobStepActionSource source; + + /** + * The action value, for example the text of the T-SQL script to execute. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the type value. + * + * @return the type value + */ + public JobStepActionType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withType(JobStepActionType type) { + this.type = type; + return this; + } + + /** + * Get the source value. + * + * @return the source value + */ + public JobStepActionSource source() { + return this.source; + } + + /** + * Set the source value. + * + * @param source the source value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withSource(JobStepActionSource source) { + this.source = source; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the JobStepAction object itself. + */ + public JobStepAction withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionSource.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionSource.java new file mode 100644 index 00000000000..b030a6711f8 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionSource.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionSource. + */ +public final class JobStepActionSource extends ExpandableStringEnum { + /** Static value Inline for JobStepActionSource. */ + public static final JobStepActionSource INLINE = fromString("Inline"); + + /** + * Creates or finds a JobStepActionSource from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionSource + */ + @JsonCreator + public static JobStepActionSource fromString(String name) { + return fromString(name, JobStepActionSource.class); + } + + /** + * @return known JobStepActionSource values + */ + public static Collection values() { + return values(JobStepActionSource.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionType.java new file mode 100644 index 00000000000..7012f3e376d --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepActionType.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepActionType. + */ +public final class JobStepActionType extends ExpandableStringEnum { + /** Static value TSql for JobStepActionType. */ + public static final JobStepActionType TSQL = fromString("TSql"); + + /** + * Creates or finds a JobStepActionType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepActionType + */ + @JsonCreator + public static JobStepActionType fromString(String name) { + return fromString(name, JobStepActionType.class); + } + + /** + * @return known JobStepActionType values + */ + public static Collection values() { + return values(JobStepActionType.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepExecutionOptions.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepExecutionOptions.java new file mode 100644 index 00000000000..deb9b752891 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepExecutionOptions.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The execution options of a job step. + */ +public class JobStepExecutionOptions { + /** + * Execution timeout for the job step. + */ + @JsonProperty(value = "timeoutSeconds") + private Integer timeoutSeconds; + + /** + * Maximum number of times the job step will be reattempted if the first + * attempt fails. + */ + @JsonProperty(value = "retryAttempts") + private Integer retryAttempts; + + /** + * Initial delay between retries for job step execution. + */ + @JsonProperty(value = "initialRetryIntervalSeconds") + private Integer initialRetryIntervalSeconds; + + /** + * The maximum amount of time to wait between retries for job step + * execution. + */ + @JsonProperty(value = "maximumRetryIntervalSeconds") + private Integer maximumRetryIntervalSeconds; + + /** + * The backoff multiplier for the time between retries. + */ + @JsonProperty(value = "retryIntervalBackoffMultiplier") + private Double retryIntervalBackoffMultiplier; + + /** + * Get the timeoutSeconds value. + * + * @return the timeoutSeconds value + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set the timeoutSeconds value. + * + * @param timeoutSeconds the timeoutSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withTimeoutSeconds(Integer timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Get the retryAttempts value. + * + * @return the retryAttempts value + */ + public Integer retryAttempts() { + return this.retryAttempts; + } + + /** + * Set the retryAttempts value. + * + * @param retryAttempts the retryAttempts value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryAttempts(Integer retryAttempts) { + this.retryAttempts = retryAttempts; + return this; + } + + /** + * Get the initialRetryIntervalSeconds value. + * + * @return the initialRetryIntervalSeconds value + */ + public Integer initialRetryIntervalSeconds() { + return this.initialRetryIntervalSeconds; + } + + /** + * Set the initialRetryIntervalSeconds value. + * + * @param initialRetryIntervalSeconds the initialRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withInitialRetryIntervalSeconds(Integer initialRetryIntervalSeconds) { + this.initialRetryIntervalSeconds = initialRetryIntervalSeconds; + return this; + } + + /** + * Get the maximumRetryIntervalSeconds value. + * + * @return the maximumRetryIntervalSeconds value + */ + public Integer maximumRetryIntervalSeconds() { + return this.maximumRetryIntervalSeconds; + } + + /** + * Set the maximumRetryIntervalSeconds value. + * + * @param maximumRetryIntervalSeconds the maximumRetryIntervalSeconds value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withMaximumRetryIntervalSeconds(Integer maximumRetryIntervalSeconds) { + this.maximumRetryIntervalSeconds = maximumRetryIntervalSeconds; + return this; + } + + /** + * Get the retryIntervalBackoffMultiplier value. + * + * @return the retryIntervalBackoffMultiplier value + */ + public Double retryIntervalBackoffMultiplier() { + return this.retryIntervalBackoffMultiplier; + } + + /** + * Set the retryIntervalBackoffMultiplier value. + * + * @param retryIntervalBackoffMultiplier the retryIntervalBackoffMultiplier value to set + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryIntervalBackoffMultiplier(Double retryIntervalBackoffMultiplier) { + this.retryIntervalBackoffMultiplier = retryIntervalBackoffMultiplier; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutput.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutput.java new file mode 100644 index 00000000000..28baaa7dfeb --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutput.java @@ -0,0 +1,227 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The output configuration of a job step. + */ +public class JobStepOutput { + /** + * The output destination type. Possible values include: 'SqlDatabase'. + */ + @JsonProperty(value = "type") + private JobStepOutputType type; + + /** + * The output destination subscription id. + */ + @JsonProperty(value = "subscriptionId") + private UUID subscriptionId; + + /** + * The output destination resource group. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * The output destination server name. + */ + @JsonProperty(value = "serverName", required = true) + private String serverName; + + /** + * The output destination database. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The output destination schema. + */ + @JsonProperty(value = "schemaName") + private String schemaName; + + /** + * The output destination table. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /** + * The resource ID of the credential to use to connect to the output + * destination. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /** + * Get the type value. + * + * @return the type value + */ + public JobStepOutputType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withType(JobStepOutputType type) { + this.type = type; + return this; + } + + /** + * Get the subscriptionId value. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId value. + * + * @param subscriptionId the subscriptionId value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSubscriptionId(UUID subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroupName value. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName value. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the serverName value. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName value. + * + * @param serverName the serverName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName value. + * + * @param databaseName the databaseName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the schemaName value. + * + * @return the schemaName value + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schemaName value. + * + * @param schemaName the schemaName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the tableName value. + * + * @return the tableName value + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the tableName value. + * + * @param tableName the tableName value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the credential value. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the credential value. + * + * @param credential the credential value to set + * @return the JobStepOutput object itself. + */ + public JobStepOutput withCredential(String credential) { + this.credential = credential; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutputType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutputType.java new file mode 100644 index 00000000000..9b1d9aeae69 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobStepOutputType.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobStepOutputType. + */ +public final class JobStepOutputType extends ExpandableStringEnum { + /** Static value SqlDatabase for JobStepOutputType. */ + public static final JobStepOutputType SQL_DATABASE = fromString("SqlDatabase"); + + /** + * Creates or finds a JobStepOutputType from its string representation. + * @param name a name to look for + * @return the corresponding JobStepOutputType + */ + @JsonCreator + public static JobStepOutputType fromString(String name) { + return fromString(name, JobStepOutputType.class); + } + + /** + * @return known JobStepOutputType values + */ + public static Collection values() { + return values(JobStepOutputType.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetGroupMembershipType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetGroupMembershipType.java new file mode 100644 index 00000000000..8ace552c522 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetGroupMembershipType.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.sql; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for JobTargetGroupMembershipType. + */ +public enum JobTargetGroupMembershipType { + /** Enum value Include. */ + INCLUDE("Include"), + + /** Enum value Exclude. */ + EXCLUDE("Exclude"); + + /** The actual serialized value for a JobTargetGroupMembershipType instance. */ + private String value; + + JobTargetGroupMembershipType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobTargetGroupMembershipType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobTargetGroupMembershipType object, or null if unable to parse. + */ + @JsonCreator + public static JobTargetGroupMembershipType fromString(String value) { + JobTargetGroupMembershipType[] items = JobTargetGroupMembershipType.values(); + for (JobTargetGroupMembershipType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetType.java new file mode 100644 index 00000000000..b3d856ffe3a --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTargetType.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JobTargetType. + */ +public final class JobTargetType extends ExpandableStringEnum { + /** Static value TargetGroup for JobTargetType. */ + public static final JobTargetType TARGET_GROUP = fromString("TargetGroup"); + + /** Static value SqlDatabase for JobTargetType. */ + public static final JobTargetType SQL_DATABASE = fromString("SqlDatabase"); + + /** Static value SqlElasticPool for JobTargetType. */ + public static final JobTargetType SQL_ELASTIC_POOL = fromString("SqlElasticPool"); + + /** Static value SqlShardMap for JobTargetType. */ + public static final JobTargetType SQL_SHARD_MAP = fromString("SqlShardMap"); + + /** Static value SqlServer for JobTargetType. */ + public static final JobTargetType SQL_SERVER = fromString("SqlServer"); + + /** + * Creates or finds a JobTargetType from its string representation. + * @param name a name to look for + * @return the corresponding JobTargetType + */ + @JsonCreator + public static JobTargetType fromString(String name) { + return fromString(name, JobTargetType.class); + } + + /** + * @return known JobTargetType values + */ + public static Collection values() { + return values(JobTargetType.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ProvisioningState.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ProvisioningState.java new file mode 100644 index 00000000000..6272a0f1b1b --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ProvisioningState.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.sql; + +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 Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value InProgress for ProvisioningState. */ + public static final ProvisioningState IN_PROGRESS = fromString("InProgress"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * @param name a name to look for + * @return the corresponding ProvisioningState + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * @return known ProvisioningState values + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentInner.java new file mode 100644 index 00000000000..0cf0561cff3 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentInner.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.Sku; +import com.microsoft.azure.management.sql.JobAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An Azure SQL job agent. + */ +@JsonFlatten +public class JobAgentInner extends TrackedResourceInner { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "properties.databaseId", required = true) + private String databaseId; + + /** + * The state of the job agent. Possible values include: 'Creating', + * 'Ready', 'Updating', 'Deleting', 'Disabled'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the JobAgentInner object itself. + */ + public JobAgentInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the databaseId value. + * + * @return the databaseId value + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Set the databaseId value. + * + * @param databaseId the databaseId value to set + * @return the JobAgentInner object itself. + */ + public JobAgentInner withDatabaseId(String databaseId) { + this.databaseId = databaseId; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public JobAgentState state() { + return this.state; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentsInner.java new file mode 100644 index 00000000000..2246ad04af4 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobAgentsInner.java @@ -0,0 +1,1119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.JobAgentUpdate; +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 java.util.Map; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobAgents. + */ +public class JobAgentsInner { + /** The Retrofit service to perform REST calls. */ + private JobAgentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobAgentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobAgentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobAgentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobAgents to be + * used by Retrofit to perform actually REST calls. + */ + interface JobAgentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobAgents listByServer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents") + Observable> listByServer(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @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.sql.JobAgents get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.JobAgents createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobAgents beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Body JobAgentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobAgents delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.JobAgents beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.JobAgents update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobAgents beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobAgentUpdate parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobAgents listByServerNext" }) + @GET + Observable> listByServerNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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 PagedList<JobAgentInner> object if successful. + */ + public PagedList listByServer(final String resourceGroupName, final String serverName) { + ServiceResponse> response = listByServerSinglePageAsync(resourceGroupName, serverName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @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> listByServerAsync(final String resourceGroupName, final String serverName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerSinglePageAsync(resourceGroupName, serverName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobAgentInner> object + */ + public Observable> listByServerAsync(final String resourceGroupName, final String serverName) { + return listByServerWithServiceResponseAsync(resourceGroupName, serverName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of job agents in a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobAgentInner> object + */ + public Observable>> listByServerWithServiceResponseAsync(final String resourceGroupName, final String serverName) { + return listByServerSinglePageAsync(resourceGroupName, serverName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of job agents in a server. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobAgentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerDelegate(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); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().last().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters), serviceCallback); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, parameters).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be created or updated. + * @param parameters The requested job agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 serverName, String jobAgentName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.delete(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 beginDelete(String resourceGroupName, String serverName, String jobAgentName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @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 beginDeleteAsync(String resourceGroupName, String serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.beginDelete(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @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 serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final Map tags = null; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().last().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @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 serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2017-03-01-preview"; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + Observable> observable = service.update(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final Map tags = null; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(null); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @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 JobAgentInner object if successful. + */ + public JobAgentInner beginUpdate(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).toBlocking().single().body(); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags), serviceCallback); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, tags).map(new Func1, JobAgentInner>() { + @Override + public JobAgentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent to be updated. + * @param tags Resource tags. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobAgentInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, Map tags) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + Validator.validate(tags); + final String apiVersion = "2017-03-01-preview"; + JobAgentUpdate parameters = new JobAgentUpdate(); + parameters.withTags(tags); + return service.beginUpdate(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of job agents in a server. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobAgentInner> object if successful. + */ + public PagedList listByServerNext(final String nextPageLink) { + ServiceResponse> response = listByServerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of job agents in a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByServerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByServerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of job agents in a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobAgentInner> object + */ + public Observable> listByServerNextAsync(final String nextPageLink) { + return listByServerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of job agents in a server. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobAgentInner> object + */ + public Observable>> listByServerNextWithServiceResponseAsync(final String nextPageLink) { + return listByServerNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of job agents in a server. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobAgentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByServerNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByServerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByServerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByServerNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialInner.java new file mode 100644 index 00000000000..7f05c03ccdf --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialInner.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.sql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A stored credential that can be used by a job to connect to target + * databases. + */ +@JsonFlatten +public class JobCredentialInner extends ProxyResourceInner { + /** + * The credential user name. + */ + @JsonProperty(value = "properties.username", required = true) + private String username; + + /** + * The credential password. + */ + @JsonProperty(value = "properties.password", required = true) + private String password; + + /** + * Get the username value. + * + * @return the username value + */ + public String username() { + return this.username; + } + + /** + * Set the username value. + * + * @param username the username value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password value. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set the password value. + * + * @param password the password value to set + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withPassword(String password) { + this.password = password; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialsInner.java new file mode 100644 index 00000000000..6649a7c0f8c --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobCredentialsInner.java @@ -0,0 +1,629 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobCredentials. + */ +public class JobCredentialsInner { + /** The Retrofit service to perform REST calls. */ + private JobCredentialsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobCredentialsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobCredentialsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobCredentialsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobCredentials to be + * used by Retrofit to perform actually REST calls. + */ + interface JobCredentialsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobCredentials listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.JobCredentials get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.sql.JobCredentials createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @Path("subscriptionId") String subscriptionId, @Body JobCredentialInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobCredentials delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("credentialName") String credentialName, @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.sql.JobCredentials listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 PagedList<JobCredentialInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 JobCredentialInner object if successful. + */ + public JobCredentialInner get(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a jobs credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, credentialName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 JobCredentialInner object if successful. + */ + public JobCredentialInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @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 serverName, String jobAgentName, String credentialName, JobCredentialInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters), serviceCallback); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters).map(new Func1, JobCredentialInner>() { + @Override + public JobCredentialInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @param parameters The requested job credential state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobCredentialInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName, JobCredentialInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, credentialName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).toBlocking().single().body(); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @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 serverName, String jobAgentName, String credentialName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName), serviceCallback); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job credential. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param credentialName The name of the credential. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (credentialName == null) { + throw new IllegalArgumentException("Parameter credentialName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, jobAgentName, credentialName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs credentials. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobCredentialInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs credentials. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs credentials. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobCredentialInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs credentials. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobCredentialInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionInner.java new file mode 100644 index 00000000000..4735ef7a201 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionInner.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import java.util.UUID; +import com.microsoft.azure.management.sql.JobExecutionLifecycle; +import com.microsoft.azure.management.sql.ProvisioningState; +import org.joda.time.DateTime; +import com.microsoft.azure.management.sql.JobExecutionTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An execution of a job. + */ +@JsonFlatten +public class JobExecutionInner extends ProxyResourceInner { + /** + * The job version number. + */ + @JsonProperty(value = "properties.jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /** + * The job step name. + */ + @JsonProperty(value = "properties.stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /** + * The job step id. + */ + @JsonProperty(value = "properties.stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /** + * The unique identifier of the job execution. + */ + @JsonProperty(value = "properties.jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /** + * The detailed state of the job execution. Possible values include: + * 'Created', 'InProgress', 'WaitingForChildJobExecutions', + * 'WaitingForRetry', 'Succeeded', 'SucceededWithSkipped', 'Failed', + * 'TimedOut', 'Canceled', 'Skipped'. + */ + @JsonProperty(value = "properties.lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /** + * The ARM provisioning state of the job execution. Possible values + * include: 'Created', 'InProgress', 'Succeeded', 'Failed', 'Canceled'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The time that the job execution was created. + */ + @JsonProperty(value = "properties.createTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createTime; + + /** + * The time that the job execution started. + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The time that the job execution completed. + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "properties.currentAttempts") + private Integer currentAttempts; + + /** + * Start time of the current attempt. + */ + @JsonProperty(value = "properties.currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime currentAttemptStartTime; + + /** + * The last status or error message. + */ + @JsonProperty(value = "properties.lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /** + * The target that this execution is executed on. + */ + @JsonProperty(value = "properties.target", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionTarget target; + + /** + * Get the jobVersion value. + * + * @return the jobVersion value + */ + public Integer jobVersion() { + return this.jobVersion; + } + + /** + * Get the stepName value. + * + * @return the stepName value + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the stepId value. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Get the jobExecutionId value. + * + * @return the jobExecutionId value + */ + public UUID jobExecutionId() { + return this.jobExecutionId; + } + + /** + * Get the lifecycle value. + * + * @return the lifecycle value + */ + public JobExecutionLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the createTime value. + * + * @return the createTime value + */ + public DateTime createTime() { + return this.createTime; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the currentAttempts value. + * + * @return the currentAttempts value + */ + public Integer currentAttempts() { + return this.currentAttempts; + } + + /** + * Set the currentAttempts value. + * + * @param currentAttempts the currentAttempts value to set + * @return the JobExecutionInner object itself. + */ + public JobExecutionInner withCurrentAttempts(Integer currentAttempts) { + this.currentAttempts = currentAttempts; + return this; + } + + /** + * Get the currentAttemptStartTime value. + * + * @return the currentAttemptStartTime value + */ + public DateTime currentAttemptStartTime() { + return this.currentAttemptStartTime; + } + + /** + * Get the lastMessage value. + * + * @return the lastMessage value + */ + public String lastMessage() { + return this.lastMessage; + } + + /** + * Get the target value. + * + * @return the target value + */ + public JobExecutionTarget target() { + return this.target; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionsInner.java new file mode 100644 index 00000000000..8abc6e16ac8 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobExecutionsInner.java @@ -0,0 +1,1514 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobExecutions. + */ +public class JobExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobExecutions listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/executions") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.sql.JobExecutions cancel" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel") + Observable> cancel(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.sql.JobExecutions create" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.JobExecutions beginCreate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + Observable> beginCreate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.JobExecutions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.sql.JobExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.sql.JobExecutions createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.sql.JobExecutions beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @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.sql.JobExecutions listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobExecutions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancel(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @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 cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable cancelAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return cancelWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Requests cancellation of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution to cancel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> cancelWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.cancel(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.create(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreate(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Starts an elastic job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.beginCreate(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @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 serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().last().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner beginCreateOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single().body(); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), serviceCallback); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updatess a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The job execution id to create the job execution under. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.beginCreateOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all executions in a job agent. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all executions in a job agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all executions in a job agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all executions in a job agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all executions in a job agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(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); + } + + /** + * Lists a job's executions. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists a job's executions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists a job's executions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists a job's executions. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists a job's executions. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobInner.java new file mode 100644 index 00000000000..dc0083e046c --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobInner.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A job. + */ +@JsonFlatten +public class JobInner extends ProxyResourceInner { + /** + * User-defined description of the job. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The job version number. + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /** + * Schedule properties of the job. + */ + @JsonProperty(value = "properties.schedule") + private JobSchedule schedule; + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description value. + * + * @param description the description value to set + * @return the JobInner object itself. + */ + public JobInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the version value. + * + * @return the version value + */ + public Integer version() { + return this.version; + } + + /** + * Get the schedule value. + * + * @return the schedule value + */ + public JobSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule value. + * + * @param schedule the schedule value to set + * @return the JobInner object itself. + */ + public JobInner withSchedule(JobSchedule schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepExecutionsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepExecutionsInner.java new file mode 100644 index 00000000000..54841a243f6 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepExecutionsInner.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.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobStepExecutions. + */ +public class JobStepExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobStepExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobStepExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.sql.JobStepExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @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.sql.JobStepExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single().body(); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @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 serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), serviceCallback); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a step execution of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the step executions of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the step executions of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the step executions of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the step executions of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepInner.java new file mode 100644 index 00000000000..b5cf1a863d8 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepInner.java @@ -0,0 +1,182 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.JobStepAction; +import com.microsoft.azure.management.sql.JobStepOutput; +import com.microsoft.azure.management.sql.JobStepExecutionOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A job step. + */ +@JsonFlatten +public class JobStepInner extends ProxyResourceInner { + /** + * The job step's index within the job. If not specified when creating the + * job step, it will be created as the last step. If not specified when + * updating the job step, the step id is not modified. + */ + @JsonProperty(value = "properties.stepId") + private Integer stepId; + + /** + * The resource ID of the target group that the job step will be executed + * on. + */ + @JsonProperty(value = "properties.targetGroup", required = true) + private String targetGroup; + + /** + * The resource ID of the job credential that will be used to connect to + * the targets. + */ + @JsonProperty(value = "properties.credential", required = true) + private String credential; + + /** + * The action payload of the job step. + */ + @JsonProperty(value = "properties.action", required = true) + private JobStepAction action; + + /** + * Output destination properties of the job step. + */ + @JsonProperty(value = "properties.output") + private JobStepOutput output; + + /** + * Execution options for the job step. + */ + @JsonProperty(value = "properties.executionOptions") + private JobStepExecutionOptions executionOptions; + + /** + * Get the stepId value. + * + * @return the stepId value + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Set the stepId value. + * + * @param stepId the stepId value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withStepId(Integer stepId) { + this.stepId = stepId; + return this; + } + + /** + * Get the targetGroup value. + * + * @return the targetGroup value + */ + public String targetGroup() { + return this.targetGroup; + } + + /** + * Set the targetGroup value. + * + * @param targetGroup the targetGroup value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withTargetGroup(String targetGroup) { + this.targetGroup = targetGroup; + return this; + } + + /** + * Get the credential value. + * + * @return the credential value + */ + public String credential() { + return this.credential; + } + + /** + * Set the credential value. + * + * @param credential the credential value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Get the action value. + * + * @return the action value + */ + public JobStepAction action() { + return this.action; + } + + /** + * Set the action value. + * + * @param action the action value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withAction(JobStepAction action) { + this.action = action; + return this; + } + + /** + * Get the output value. + * + * @return the output value + */ + public JobStepOutput output() { + return this.output; + } + + /** + * Set the output value. + * + * @param output the output value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withOutput(JobStepOutput output) { + this.output = output; + return this; + } + + /** + * Get the executionOptions value. + * + * @return the executionOptions value + */ + public JobStepExecutionOptions executionOptions() { + return this.executionOptions; + } + + /** + * Set the executionOptions value. + * + * @param executionOptions the executionOptions value to set + * @return the JobStepInner object itself. + */ + public JobStepInner withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepsInner.java new file mode 100644 index 00000000000..fcdd76a9f81 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobStepsInner.java @@ -0,0 +1,1032 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobSteps. + */ +public class JobStepsInner { + /** The Retrofit service to perform REST calls. */ + private JobStepsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobStepsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobStepsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobSteps to be + * used by Retrofit to perform actually REST calls. + */ + interface JobStepsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobSteps listByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps") + Observable> listByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.sql.JobSteps getByVersion" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}") + Observable> getByVersion(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @Path("stepName") String stepName, @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.sql.JobSteps listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.JobSteps get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.sql.JobSteps createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Body JobStepInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobSteps delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("stepName") String stepName, @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.sql.JobSteps listByVersionNext" }) + @GET + Observable> listByVersionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobSteps listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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 PagedList<JobStepInner> object if successful. + */ + public PagedList listByVersion(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + ServiceResponse> response = listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @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> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByVersionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByVersionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + return listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final int jobVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVersionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionDelegate(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); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner getByVersion(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).toBlocking().single().body(); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @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 getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName), serviceCallback); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getByVersionAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + return getByVersionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified version of a job step. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getByVersionWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion, String stepName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.getByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByVersionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByVersionDelegate(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 all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 PagedList<JobStepInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @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 serverName, String jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job step in a job's current version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, stepName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 JobStepInner object if successful. + */ + public JobStepInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @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 serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters), serviceCallback); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).map(new Func1, JobStepInner>() { + @Override + public JobStepInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step. + * @param parameters The requested state of the job step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobStepInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, stepName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, String jobAgentName, String jobName, String stepName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).toBlocking().single().body(); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @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 serverName, String jobAgentName, String jobName, String stepName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName), serviceCallback); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param stepName The name of the job step to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, jobAgentName, jobName, stepName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all job steps in the specified job version. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobStepInner> object if successful. + */ + public PagedList listByVersionNext(final String nextPageLink) { + ServiceResponse> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps in the specified job version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByVersionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVersionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps in the specified job version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByVersionNextAsync(final String nextPageLink) { + return listByVersionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByVersionNextWithServiceResponseAsync(final String nextPageLink) { + return listByVersionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByVersionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps in the specified job version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVersionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByVersionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVersionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVersionNextDelegate(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); + } + + /** + * Gets all job steps for a job's current version. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobStepInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all job steps for a job's current version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all job steps for a job's current version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobStepInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all job steps for a job's current version. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobStepInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetExecutionsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetExecutionsInner.java new file mode 100644 index 00000000000..c4e264b52ad --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetExecutionsInner.java @@ -0,0 +1,1091 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobTargetExecutions. + */ +public class JobTargetExecutionsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetExecutionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetExecutionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetExecutionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetExecutionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetExecutions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetExecutionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobTargetExecutions listByJobExecution" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets") + Observable> listByJobExecution(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.sql.JobTargetExecutions listByStep" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets") + Observable> listByStep(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("subscriptionId") String subscriptionId, @Query("createTimeMin") DateTime createTimeMin, @Query("createTimeMax") DateTime createTimeMax, @Query("endTimeMin") DateTime endTimeMin, @Query("endTimeMax") DateTime endTimeMax, @Query("isActive") Boolean isActive, @Query("$skip") Integer skip, @Query("$top") Integer top, @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.sql.JobTargetExecutions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}/targets/{targetId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobExecutionId") UUID jobExecutionId, @Path("stepName") String stepName, @Path("targetId") UUID targetId, @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.sql.JobTargetExecutions listByJobExecutionNext" }) + @GET + Observable> listByJobExecutionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobTargetExecutions listByStepNext" }) + @GET + Observable> listByStepNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecution(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByJobExecutionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionDelegate(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); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + final DateTime createTimeMin = null; + final DateTime createTimeMax = null; + final DateTime endTimeMin = null; + final DateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return service.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByStep(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + ServiceResponse> response = listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @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> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The id of the job execution + * @param stepName The name of the step. + * @param createTimeMin If specified, only job executions created at or after the specified time are included. + * @param createTimeMax If specified, only job executions created before the specified time are included. + * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + * @param endTimeMax If specified, only job executions completed before the specified time are included. + * @param isActive If specified, only active or only completed job executions are included. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + return listByStepSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + ServiceResponse> * @param jobExecutionId The id of the job execution + ServiceResponse> * @param stepName The name of the step. + ServiceResponse> * @param createTimeMin If specified, only job executions created at or after the specified time are included. + ServiceResponse> * @param createTimeMax If specified, only job executions created before the specified time are included. + ServiceResponse> * @param endTimeMin If specified, only job executions completed at or after the specified time are included. + ServiceResponse> * @param endTimeMax If specified, only job executions completed before the specified time are included. + ServiceResponse> * @param isActive If specified, only active or only completed job executions are included. + ServiceResponse> * @param skip The number of elements in the collection to skip. + ServiceResponse> * @param top The number of elements to return from the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final UUID jobExecutionId, final String stepName, final DateTime createTimeMin, final DateTime createTimeMax, final DateTime endTimeMin, final DateTime endTimeMax, final Boolean isActive, final Integer skip, final Integer top) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, this.client.subscriptionId(), createTimeMin, createTimeMax, endTimeMin, endTimeMax, isActive, skip, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepDelegate(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); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 JobExecutionInner object if successful. + */ + public JobExecutionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).toBlocking().single().body(); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @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 serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId), serviceCallback); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId).map(new Func1, JobExecutionInner>() { + @Override + public JobExecutionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target execution. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param jobExecutionId The unique id of the job execution + * @param stepName The name of the step. + * @param targetId The target id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobExecutionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId, String stepName, UUID targetId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (jobExecutionId == null) { + throw new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null."); + } + if (stepName == null) { + throw new IllegalArgumentException("Parameter stepName is required and cannot be null."); + } + if (targetId == null) { + throw new IllegalArgumentException("Parameter targetId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByJobExecutionNext(final String nextPageLink) { + ServiceResponse> response = listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByJobExecutionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobExecutionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByJobExecutionNextAsync(final String nextPageLink) { + return listByJobExecutionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByJobExecutionNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobExecutionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobExecutionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists target executions for all steps of a job execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobExecutionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByJobExecutionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobExecutionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobExecutionNextDelegate(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); + } + + /** + * Lists the target executions of a job step execution. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobExecutionInner> object if successful. + */ + public PagedList listByStepNext(final String nextPageLink) { + ServiceResponse> response = listByStepNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the target executions of a job step execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByStepNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByStepNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the target executions of a job step execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable> listByStepNextAsync(final String nextPageLink) { + return listByStepNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobExecutionInner> object + */ + public Observable>> listByStepNextWithServiceResponseAsync(final String nextPageLink) { + return listByStepNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByStepNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the target executions of a job step execution. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobExecutionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByStepNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByStepNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByStepNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByStepNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java new file mode 100644 index 00000000000..b7b69073308 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.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.sql.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A group of job targets. + */ +@JsonFlatten +public class JobTargetGroupInner extends ProxyResourceInner { + /** + * Members of the target group. + */ + @JsonProperty(value = "properties.members", required = true) + private List members; + + /** + * Get the members value. + * + * @return the members value + */ + public List members() { + return this.members; + } + + /** + * Set the members value. + * + * @param members the members value to set + * @return the JobTargetGroupInner object itself. + */ + public JobTargetGroupInner withMembers(List members) { + this.members = members; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java new file mode 100644 index 00000000000..0f968eb9cae --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java @@ -0,0 +1,631 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobTargetGroups. + */ +public class JobTargetGroupsInner { + /** The Retrofit service to perform REST calls. */ + private JobTargetGroupsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobTargetGroupsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobTargetGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobTargetGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface JobTargetGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobTargetGroups listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.JobTargetGroups get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.sql.JobTargetGroups createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body JobTargetGroupInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobTargetGroups delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("targetGroupName") String targetGroupName, @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.sql.JobTargetGroups listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 PagedList<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target 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 getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, targetGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the JobTargetGroupInner object if successful. + */ + public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target 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 createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members), serviceCallback); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1, JobTargetGroupInner>() { + @Override + public JobTargetGroupInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @param members Members of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobTargetGroupInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName 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 (members == null) { + throw new IllegalArgumentException("Parameter members is required and cannot be null."); + } + Validator.validate(members); + final String apiVersion = "2017-03-01-preview"; + JobTargetGroupInner parameters = new JobTargetGroupInner(); + parameters.withMembers(members); + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, targetGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).toBlocking().single().body(); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target 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 serverName, String jobAgentName, String targetGroupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName), serviceCallback); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a target group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param targetGroupName The name of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (targetGroupName == null) { + throw new IllegalArgumentException("Parameter targetGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, jobAgentName, targetGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all target groups in an agent. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobTargetGroupInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all target groups in an agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all target groups in an agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all target groups in an agent. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobTargetGroupInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all target groups in an agent. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobTargetGroupInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetInner.java new file mode 100644 index 00000000000..62504d35fa7 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetInner.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.JobTargetGroupMembershipType; +import com.microsoft.azure.management.sql.JobTargetType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job target, for example a specific database or a container of databases + * that is evaluated during job execution. + */ +public class JobTargetInner { + /** + * Whether the target is included or excluded from the group. Possible + * values include: 'Include', 'Exclude'. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /** + * The target type. Possible values include: 'TargetGroup', 'SqlDatabase', + * 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", required = true) + private JobTargetType type; + + /** + * The target server name. + */ + @JsonProperty(value = "serverName") + private String serverName; + + /** + * The target database name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /** + * The target elastic pool name. + */ + @JsonProperty(value = "elasticPoolName") + private String elasticPoolName; + + /** + * The target shard map. + */ + @JsonProperty(value = "shardMapName") + private String shardMapName; + + /** + * The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the + * target. + */ + @JsonProperty(value = "refreshCredential") + private String refreshCredential; + + /** + * Get the membershipType value. + * + * @return the membershipType value + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set the membershipType value. + * + * @param membershipType the membershipType value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the serverName value. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName value. + * + * @param serverName the serverName value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName value. + * + * @param databaseName the databaseName value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the elasticPoolName value. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the elasticPoolName value. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the shardMapName value. + * + * @return the shardMapName value + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the shardMapName value. + * + * @param shardMapName the shardMapName value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withShardMapName(String shardMapName) { + this.shardMapName = shardMapName; + return this; + } + + /** + * Get the refreshCredential value. + * + * @return the refreshCredential value + */ + public String refreshCredential() { + return this.refreshCredential; + } + + /** + * Set the refreshCredential value. + * + * @param refreshCredential the refreshCredential value to set + * @return the JobTargetInner object itself. + */ + public JobTargetInner withRefreshCredential(String refreshCredential) { + this.refreshCredential = refreshCredential; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionInner.java new file mode 100644 index 00000000000..4aed19efbfa --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionInner.java @@ -0,0 +1,16 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + + +/** + * A job version. + */ +public class JobVersionInner extends ProxyResourceInner { +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionsInner.java new file mode 100644 index 00000000000..662977e7f5d --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobVersionsInner.java @@ -0,0 +1,424 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in JobVersions. + */ +public class JobVersionsInner { + /** The Retrofit service to perform REST calls. */ + private JobVersionsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobVersionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobVersionsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobVersionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for JobVersions to be + * used by Retrofit to perform actually REST calls. + */ + interface JobVersionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.JobVersions listByJob" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions") + Observable> listByJob(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.JobVersions get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("jobVersion") int jobVersion, @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.sql.JobVersions listByJobNext" }) + @GET + Observable> listByJobNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 PagedList<JobVersionInner> object if successful. + */ + public PagedList listByJob(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + ServiceResponse> response = listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable> listByJobAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + return listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + ServiceResponse> * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByJob(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobDelegate(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); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 JobVersionInner object if successful. + */ + public JobVersionInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).toBlocking().single().body(); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @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 serverName, String jobAgentName, String jobName, int jobVersion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), serviceCallback); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion).map(new Func1, JobVersionInner>() { + @Override + public JobVersionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job version. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @param jobVersion The version of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobVersionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all versions of a job. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobVersionInner> object if successful. + */ + public PagedList listByJobNext(final String nextPageLink) { + ServiceResponse> response = listByJobNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all versions of a job. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByJobNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByJobNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all versions of a job. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable> listByJobNextAsync(final String nextPageLink) { + return listByJobNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all versions of a job. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobVersionInner> object + */ + public Observable>> listByJobNextWithServiceResponseAsync(final String nextPageLink) { + return listByJobNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all versions of a job. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobVersionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByJobNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByJobNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByJobNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByJobNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobsInner.java new file mode 100644 index 00000000000..3692b1104b5 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobsInner.java @@ -0,0 +1,629 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Jobs. + */ +public class JobsInner { + /** The Retrofit service to perform REST calls. */ + private JobsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of JobsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public JobsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(JobsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Jobs to be + * used by Retrofit to perform actually REST calls. + */ + interface JobsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Jobs listByAgent" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs") + Observable> listByAgent(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @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.sql.Jobs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.Jobs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @Path("subscriptionId") String subscriptionId, @Body JobInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Jobs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("jobAgentName") String jobAgentName, @Path("jobName") String jobName, @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.sql.Jobs listByAgentNext" }) + @GET + Observable> listByAgentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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 PagedList<JobInner> object if successful. + */ + public PagedList listByAgent(final String resourceGroupName, final String serverName, final String jobAgentName) { + ServiceResponse> response = listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @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> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable> listByAgentAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable>> listByAgentWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + return listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param jobAgentName The name of the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentSinglePageAsync(final String resourceGroupName, final String serverName, final String jobAgentName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.listByAgent(resourceGroupName, serverName, jobAgentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentDelegate(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); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 JobInner object if successful. + */ + public JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @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 serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 JobInner object if successful. + */ + public JobInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @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 serverName, String jobAgentName, String jobName, JobInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters), serviceCallback); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters).map(new Func1, JobInner>() { + @Override + public JobInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to get. + * @param parameters The requested job state. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the JobInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-03-01-preview"; + return service.createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().single().body(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @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 serverName, String jobAgentName, String jobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName), serviceCallback); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (jobAgentName == null) { + throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null."); + } + if (jobName == null) { + throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, jobAgentName, jobName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of jobs. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<JobInner> object if successful. + */ + public PagedList listByAgentNext(final String nextPageLink) { + ServiceResponse> response = listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of jobs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByAgentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByAgentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of jobs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable> listByAgentNextAsync(final String nextPageLink) { + return listByAgentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of jobs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<JobInner> object + */ + public Observable>> listByAgentNextWithServiceResponseAsync(final String nextPageLink) { + return listByAgentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByAgentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of jobs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<JobInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByAgentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByAgentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByAgentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByAgentNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java index 514be65e015..42fba75ab35 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java @@ -653,6 +653,123 @@ public RestorePointsInner restorePoints() { return this.restorePoints; } + /** + * The JobAgentsInner object to access its operations. + */ + private JobAgentsInner jobAgents; + + /** + * Gets the JobAgentsInner object to access its operations. + * @return the JobAgentsInner object. + */ + public JobAgentsInner jobAgents() { + return this.jobAgents; + } + + /** + * The JobCredentialsInner object to access its operations. + */ + private JobCredentialsInner jobCredentials; + + /** + * Gets the JobCredentialsInner object to access its operations. + * @return the JobCredentialsInner object. + */ + public JobCredentialsInner jobCredentials() { + return this.jobCredentials; + } + + /** + * The JobExecutionsInner object to access its operations. + */ + private JobExecutionsInner jobExecutions; + + /** + * Gets the JobExecutionsInner object to access its operations. + * @return the JobExecutionsInner object. + */ + public JobExecutionsInner jobExecutions() { + return this.jobExecutions; + } + + /** + * The JobsInner object to access its operations. + */ + private JobsInner jobs; + + /** + * Gets the JobsInner object to access its operations. + * @return the JobsInner object. + */ + public JobsInner jobs() { + return this.jobs; + } + + /** + * The JobStepExecutionsInner object to access its operations. + */ + private JobStepExecutionsInner jobStepExecutions; + + /** + * Gets the JobStepExecutionsInner object to access its operations. + * @return the JobStepExecutionsInner object. + */ + public JobStepExecutionsInner jobStepExecutions() { + return this.jobStepExecutions; + } + + /** + * The JobStepsInner object to access its operations. + */ + private JobStepsInner jobSteps; + + /** + * Gets the JobStepsInner object to access its operations. + * @return the JobStepsInner object. + */ + public JobStepsInner jobSteps() { + return this.jobSteps; + } + + /** + * The JobTargetExecutionsInner object to access its operations. + */ + private JobTargetExecutionsInner jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsInner object to access its operations. + * @return the JobTargetExecutionsInner object. + */ + public JobTargetExecutionsInner jobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** + * The JobTargetGroupsInner object to access its operations. + */ + private JobTargetGroupsInner jobTargetGroups; + + /** + * Gets the JobTargetGroupsInner object to access its operations. + * @return the JobTargetGroupsInner object. + */ + public JobTargetGroupsInner jobTargetGroups() { + return this.jobTargetGroups; + } + + /** + * The JobVersionsInner object to access its operations. + */ + private JobVersionsInner jobVersions; + + /** + * Gets the JobVersionsInner object to access its operations. + * @return the JobVersionsInner object. + */ + public JobVersionsInner jobVersions() { + return this.jobVersions; + } + /** * The DatabaseOperationsInner object to access its operations. */ @@ -780,6 +897,15 @@ protected void initialize() { this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); + this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); + this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); + this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); + this.jobs = new JobsInner(restClient().retrofit(), this); + this.jobStepExecutions = new JobStepExecutionsInner(restClient().retrofit(), this); + this.jobSteps = new JobStepsInner(restClient().retrofit(), this); + this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); + this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); + this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); From 2cc97dd9efd03deec9cf471d3717f128566b4bb4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 20 Apr 2018 19:46:02 +0000 Subject: [PATCH 2/4] Generated from 734f2e9aca7cddbc2e2a673f6c18e211fce7079b Updates to jobs.json as well as examples, this time keeping out readme.md until ready to publish sdk --- .../ShortTermRetentionPoliciesInner.java | 861 ++++++++++++++++++ .../ShortTermRetentionPolicyInner.java | 46 + .../SqlManagementClientImpl.java | 140 +-- 3 files changed, 921 insertions(+), 126 deletions(-) create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPoliciesInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPolicyInner.java diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPoliciesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPoliciesInner.java new file mode 100644 index 00000000000..2b212db1bcd --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPoliciesInner.java @@ -0,0 +1,861 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +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 ShortTermRetentionPolicies. + */ +public class ShortTermRetentionPoliciesInner { + /** The Retrofit service to perform REST calls. */ + private ShortTermRetentionPoliciesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of ShortTermRetentionPoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ShortTermRetentionPoliciesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(ShortTermRetentionPoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ShortTermRetentionPolicies to be + * used by Retrofit to perform actually REST calls. + */ + interface ShortTermRetentionPoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ShortTermRetentionPolicies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @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.sql.ShortTermRetentionPolicies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ShortTermRetentionPolicies beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ShortTermRetentionPolicies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ShortTermRetentionPolicies beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("policyName") String policyName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ShortTermRetentionPolicyInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + final Integer retentionDays = null; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + final Integer retentionDays = null; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().last().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + final Integer retentionDays = null; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner update(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().last().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + Observable> observable = service.update(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + final Integer retentionDays = null; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(null); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 ShortTermRetentionPolicyInner object if successful. + */ + public ShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body(); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @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 beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays), serviceCallback); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).map(new Func1, ShortTermRetentionPolicyInner>() { + @Override + public ShortTermRetentionPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ShortTermRetentionPolicyInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String policyName = "default"; + final String apiVersion = "2017-10-01-preview"; + ShortTermRetentionPolicyInner parameters = new ShortTermRetentionPolicyInner(); + parameters.withRetentionDays(retentionDays); + return service.beginUpdate(resourceGroupName, serverName, databaseName, policyName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPolicyInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPolicyInner.java new file mode 100644 index 00000000000..8c84187bd28 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ShortTermRetentionPolicyInner.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.sql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A short term retention policy resource. + */ +@JsonFlatten +public class ShortTermRetentionPolicyInner extends ProxyResourceInner { + /** + * The backup retention period in days. This is how many days Point-in-Time + * Restore will be supported. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the retentionDays value. + * + * @return the retentionDays value + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays value. + * + * @param retentionDays the retentionDays value to set + * @return the ShortTermRetentionPolicyInner object itself. + */ + public ShortTermRetentionPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java index 42fba75ab35..7bc6f025165 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java @@ -653,123 +653,6 @@ public RestorePointsInner restorePoints() { return this.restorePoints; } - /** - * The JobAgentsInner object to access its operations. - */ - private JobAgentsInner jobAgents; - - /** - * Gets the JobAgentsInner object to access its operations. - * @return the JobAgentsInner object. - */ - public JobAgentsInner jobAgents() { - return this.jobAgents; - } - - /** - * The JobCredentialsInner object to access its operations. - */ - private JobCredentialsInner jobCredentials; - - /** - * Gets the JobCredentialsInner object to access its operations. - * @return the JobCredentialsInner object. - */ - public JobCredentialsInner jobCredentials() { - return this.jobCredentials; - } - - /** - * The JobExecutionsInner object to access its operations. - */ - private JobExecutionsInner jobExecutions; - - /** - * Gets the JobExecutionsInner object to access its operations. - * @return the JobExecutionsInner object. - */ - public JobExecutionsInner jobExecutions() { - return this.jobExecutions; - } - - /** - * The JobsInner object to access its operations. - */ - private JobsInner jobs; - - /** - * Gets the JobsInner object to access its operations. - * @return the JobsInner object. - */ - public JobsInner jobs() { - return this.jobs; - } - - /** - * The JobStepExecutionsInner object to access its operations. - */ - private JobStepExecutionsInner jobStepExecutions; - - /** - * Gets the JobStepExecutionsInner object to access its operations. - * @return the JobStepExecutionsInner object. - */ - public JobStepExecutionsInner jobStepExecutions() { - return this.jobStepExecutions; - } - - /** - * The JobStepsInner object to access its operations. - */ - private JobStepsInner jobSteps; - - /** - * Gets the JobStepsInner object to access its operations. - * @return the JobStepsInner object. - */ - public JobStepsInner jobSteps() { - return this.jobSteps; - } - - /** - * The JobTargetExecutionsInner object to access its operations. - */ - private JobTargetExecutionsInner jobTargetExecutions; - - /** - * Gets the JobTargetExecutionsInner object to access its operations. - * @return the JobTargetExecutionsInner object. - */ - public JobTargetExecutionsInner jobTargetExecutions() { - return this.jobTargetExecutions; - } - - /** - * The JobTargetGroupsInner object to access its operations. - */ - private JobTargetGroupsInner jobTargetGroups; - - /** - * Gets the JobTargetGroupsInner object to access its operations. - * @return the JobTargetGroupsInner object. - */ - public JobTargetGroupsInner jobTargetGroups() { - return this.jobTargetGroups; - } - - /** - * The JobVersionsInner object to access its operations. - */ - private JobVersionsInner jobVersions; - - /** - * Gets the JobVersionsInner object to access its operations. - * @return the JobVersionsInner object. - */ - public JobVersionsInner jobVersions() { - return this.jobVersions; - } - /** * The DatabaseOperationsInner object to access its operations. */ @@ -822,6 +705,19 @@ public InstanceFailoverGroupsInner instanceFailoverGroups() { return this.instanceFailoverGroups; } + /** + * The ShortTermRetentionPoliciesInner object to access its operations. + */ + private ShortTermRetentionPoliciesInner shortTermRetentionPolicies; + + /** + * Gets the ShortTermRetentionPoliciesInner object to access its operations. + * @return the ShortTermRetentionPoliciesInner object. + */ + public ShortTermRetentionPoliciesInner shortTermRetentionPolicies() { + return this.shortTermRetentionPolicies; + } + /** * Initializes an instance of SqlManagementClient client. * @@ -897,19 +793,11 @@ protected void initialize() { this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); - this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); - this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); - this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); - this.jobs = new JobsInner(restClient().retrofit(), this); - this.jobStepExecutions = new JobStepExecutionsInner(restClient().retrofit(), this); - this.jobSteps = new JobStepsInner(restClient().retrofit(), this); - this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); - this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); - this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); + this.shortTermRetentionPolicies = new ShortTermRetentionPoliciesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } From 91420014852bf865bad8ad52e224f6b2b9b35adc Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 17 May 2018 19:08:33 +0000 Subject: [PATCH 3/4] Generated from 748aec06ad4c47bd52dee94d189d9c3d7f391bca Updated readme.md to include jobs.json. Fixed job step output examples --- .../azure/management/sql/DatabaseUpdate.java | 696 +++++++++++++++++ ...lnerabilityAssessmentRuleBaselineItem.java | 45 ++ .../management/sql/ElasticPoolUpdate.java | 179 +++++ .../azure/management/sql/ExportRequest.java | 175 +++++ .../management/sql/FailoverGroupUpdate.java | 125 ++++ .../sql/ImportExtensionRequest.java | 262 +++++++ .../azure/management/sql/ImportRequest.java | 132 ++++ .../azure/management/sql/JobTarget.java | 204 +++++ .../management/sql/ManagedDatabaseUpdate.java | 319 ++++++++ .../management/sql/ManagedInstanceUpdate.java | 261 +++++++ .../azure/management/sql/ServerUpdate.java | 155 ++++ ...ityAssessmentRecurringScansProperties.java | 98 +++ .../sql/VulnerabilityAssessmentScanError.java | 47 ++ .../sql/VulnerabilityAssessmentScanState.java | 47 ++ ...ulnerabilityAssessmentScanTriggerType.java | 41 + .../implementation/DataMaskingRulesInner.java | 6 +- .../implementation/DatabaseUsagesInner.java | 6 +- .../DatabaseVulnerabilityAssessmentInner.java | 100 +++ ...nerabilityAssessmentRuleBaselineInner.java | 47 ++ ...erabilityAssessmentRuleBaselinesInner.java | 383 ++++++++++ ...lnerabilityAssessmentScansExportInner.java | 35 + ...baseVulnerabilityAssessmentScansInner.java | 707 ++++++++++++++++++ ...DatabaseVulnerabilityAssessmentsInner.java | 356 +++++++++ .../sql/implementation/DatabasesInner.java | 96 +-- .../ElasticPoolActivitiesInner.java | 6 +- .../ElasticPoolDatabaseActivitiesInner.java | 6 +- .../sql/implementation/ElasticPoolsInner.java | 33 +- .../implementation/FailoverGroupsInner.java | 21 +- .../implementation/FirewallRulesInner.java | 6 +- .../GeoBackupPoliciesInner.java | 6 +- .../implementation/JobTargetGroupInner.java | 7 +- .../implementation/JobTargetGroupsInner.java | 9 +- .../implementation/ManagedDatabasesInner.java | 21 +- .../implementation/ManagedInstancesInner.java | 21 +- .../implementation/ProxyResourceInner.java | 4 +- .../RecommendedElasticPoolsInner.java | 12 +- .../RecoverableDatabasesInner.java | 6 +- .../implementation/ReplicationLinksInner.java | 6 +- .../RestorableDroppedDatabasesInner.java | 6 +- .../implementation/RestorePointsInner.java | 6 +- .../ServerAzureADAdministratorsInner.java | 6 +- .../ServerCommunicationLinksInner.java | 6 +- .../sql/implementation/ServerUsagesInner.java | 6 +- .../sql/implementation/ServersInner.java | 21 +- .../ServiceObjectivesInner.java | 6 +- .../ServiceTierAdvisorsInner.java | 6 +- .../SqlManagementClientImpl.java | 168 +++++ .../implementation/TrackedResourceInner.java | 4 +- ...nsparentDataEncryptionActivitiesInner.java | 6 +- ...ulnerabilityAssessmentScanRecordInner.java | 145 ++++ 50 files changed, 4949 insertions(+), 123 deletions(-) create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ExportRequest.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/FailoverGroupUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportExtensionRequest.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportRequest.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTarget.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstanceUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServerUpdate.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanError.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanState.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanTriggerType.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentsInner.java create mode 100644 azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/VulnerabilityAssessmentScanRecordInner.java diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseUpdate.java new file mode 100644 index 00000000000..efeed50f9d1 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseUpdate.java @@ -0,0 +1,696 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.UUID; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database resource. + */ +@JsonFlatten +public class DatabaseUpdate { + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Specifies the mode of database creation. + * + * Default: regular database creation. + * + * Copy: creates a database as a copy of an existing database. + * sourceDatabaseId must be specified as the resource ID of the source + * database. + * + * Secondary: creates a database as a secondary replica of an existing + * database. sourceDatabaseId must be specified as the resource ID of the + * existing primary database. + * + * PointInTimeRestore: Creates a database by restoring a point in time + * backup of an existing database. sourceDatabaseId must be specified as + * the resource ID of the existing database, and restorePointInTime must be + * specified. + * + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource + * ID to restore. + * + * Restore: Creates a database by restoring a backup of a deleted database. + * sourceDatabaseId must be specified. If sourceDatabaseId is the + * database's original resource ID, then sourceDatabaseDeletionDate must be + * specified. Otherwise sourceDatabaseId must be the restorable dropped + * database resource ID and sourceDatabaseDeletionDate is ignored. + * restorePointInTime may also be specified to restore from an earlier + * point in time. + * + * RestoreLongTermRetentionBackup: Creates a database by restoring from a + * long term retention vault. recoveryServicesRecoveryPointResourceId must + * be specified as the recovery point resource ID. + * + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported + * for DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary'. + */ + @JsonProperty(value = "properties.createMode") + private CreateMode createMode; + + /** + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The name of the sample schema to apply when creating this database. + * Possible values include: 'AdventureWorksLT', 'WideWorldImportersStd', + * 'WideWorldImportersFull'. + */ + @JsonProperty(value = "properties.sampleName") + private SampleName sampleName; + + /** + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "properties.elasticPoolId") + private String elasticPoolId; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * The status of the database. Possible values include: 'Online', + * 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', + * 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /** + * The ID of the database. + */ + @JsonProperty(value = "properties.databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /** + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The current service level objective name of the database. + */ + @JsonProperty(value = "properties.currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /** + * The requested service level objective name of the database. + */ + @JsonProperty(value = "properties.requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /** + * The default secondary region for this database. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "properties.sourceDatabaseDeletionDate") + private DateTime sourceDatabaseDeletionDate; + + /** + * The resource identifier of the recovery point associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /** + * The resource identifier of the long term retention backup associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /** + * The resource identifier of the recoverable database associated with + * create operation of this database. + */ + @JsonProperty(value = "properties.recoverableDatabaseId") + private String recoverableDatabaseId; + + /** + * The resource identifier of the restorable dropped database associated + * with create operation of this database. + */ + @JsonProperty(value = "properties.restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Whether or not this database is zone redundant, which means the replicas + * of this database will be spread across multiple availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this database. Possible values include: + * 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private DatabaseLicenseType licenseType; + + /** + * The max log size for this database. + */ + @JsonProperty(value = "properties.maxLogSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxLogSizeBytes; + + /** + * This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + */ + @JsonProperty(value = "properties.earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestoreDate; + + /** + * The state of read-only routing. If enabled, connections that have + * application intent set to readonly in their connection string may be + * routed to a readonly secondary replica in the same region. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.readScale") + private DatabaseReadScale readScale; + + /** + * The name and tier of the SKU. + */ + @JsonProperty(value = "properties.currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation value. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation value. + * + * @param collation the collation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxSizeBytes value. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes value. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the sampleName value. + * + * @return the sampleName value + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the sampleName value. + * + * @param sampleName the sampleName value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the elasticPoolId value. + * + * @return the elasticPoolId value + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the elasticPoolId value. + * + * @param elasticPoolId the elasticPoolId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the sourceDatabaseId value. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId value. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the databaseId value. + * + * @return the databaseId value + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creationDate value. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the currentServiceObjectiveName value. + * + * @return the currentServiceObjectiveName value + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requestedServiceObjectiveName value. + * + * @return the requestedServiceObjectiveName value + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the defaultSecondaryLocation value. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the failoverGroupId value. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the restorePointInTime value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the sourceDatabaseDeletionDate value. + * + * @return the sourceDatabaseDeletionDate value + */ + public DateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set the sourceDatabaseDeletionDate value. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(DateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId value. + * + * @return the recoveryServicesRecoveryPointId value + */ + public String recoveryServicesRecoveryPointId() { + return this.recoveryServicesRecoveryPointId; + } + + /** + * Set the recoveryServicesRecoveryPointId value. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId value. + * + * @return the longTermRetentionBackupResourceId value + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId value. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the recoverableDatabaseId value. + * + * @return the recoverableDatabaseId value + */ + public String recoverableDatabaseId() { + return this.recoverableDatabaseId; + } + + /** + * Set the recoverableDatabaseId value. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId value. + * + * @return the restorableDroppedDatabaseId value + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId value. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the catalogCollation value. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation value. + * + * @param catalogCollation the catalogCollation value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the zoneRedundant value. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant value. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maxLogSizeBytes value. + * + * @return the maxLogSizeBytes value + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get the earliestRestoreDate value. + * + * @return the earliestRestoreDate value + */ + public DateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the readScale value. + * + * @return the readScale value + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the readScale value. + * + * @param readScale the readScale value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the currentSku value. + * + * @return the currentSku value + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 00000000000..ec8519b807a --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/DatabaseVulnerabilityAssessmentRuleBaselineItem.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.sql; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for an Azure SQL Database Vulnerability Assessment rule + * baseline's result. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /** + * The rule baseline result. + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** + * Get the result value. + * + * @return the result value + */ + public List result() { + return this.result; + } + + /** + * Set the result value. + * + * @param result the result value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineItem object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem withResult(List result) { + this.result = result; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolUpdate.java new file mode 100644 index 00000000000..0c664da6d35 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ElasticPoolUpdate.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An elastic pool update. + */ +@JsonFlatten +public class ElasticPoolUpdate { + /** + * The sku property. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "properties.maxSizeBytes") + private Long maxSizeBytes; + + /** + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "properties.perDatabaseSettings") + private ElasticPoolPerDatabaseSettings perDatabaseSettings; + + /** + * Whether or not this elastic pool is zone redundant, which means the + * replicas of this elastic pool will be spread across multiple + * availability zones. + */ + @JsonProperty(value = "properties.zoneRedundant") + private Boolean zoneRedundant; + + /** + * The license type to apply for this elastic pool. Possible values + * include: 'LicenseIncluded', 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private ElasticPoolLicenseType licenseType; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the maxSizeBytes value. + * + * @return the maxSizeBytes value + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes value. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the perDatabaseSettings value. + * + * @return the perDatabaseSettings value + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the perDatabaseSettings value. + * + * @param perDatabaseSettings the perDatabaseSettings value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get the zoneRedundant value. + * + * @return the zoneRedundant value + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant value. + * + * @param zoneRedundant the zoneRedundant value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ExportRequest.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ExportRequest.java new file mode 100644 index 00000000000..973ca35e053 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ExportRequest.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Export database parameters. + */ +public class ExportRequest { + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "authenticationType") + private AuthenticationType authenticationType; + + /** + * Get the storageKeyType value. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType value. + * + * @param storageKeyType the storageKeyType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey value. + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey value. + * + * @param storageKey the storageKey value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri value. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri value. + * + * @param storageUri the storageUri value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType value. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType value. + * + * @param authenticationType the authenticationType value to set + * @return the ExportRequest object itself. + */ + public ExportRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/FailoverGroupUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/FailoverGroupUpdate.java new file mode 100644 index 00000000000..9b2ea932ee4 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/FailoverGroupUpdate.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.sql; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A failover group update request. + */ +@JsonFlatten +public class FailoverGroupUpdate { + /** + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /** + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "properties.readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /** + * List of databases in the failover group. + */ + @JsonProperty(value = "properties.databases") + private List databases; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the readWriteEndpoint value. + * + * @return the readWriteEndpoint value + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint value. + * + * @param readWriteEndpoint the readWriteEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint value. + * + * @return the readOnlyEndpoint value + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint value. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the databases value. + * + * @return the databases value + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases value. + * + * @param databases the databases value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportExtensionRequest.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportExtensionRequest.java new file mode 100644 index 00000000000..9d3348ec422 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportExtensionRequest.java @@ -0,0 +1,262 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Import database parameters. + */ +@JsonFlatten +public class ImportExtensionRequest { + /** + * The name of the extension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The type of the extension. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The type of the storage key to use. Possible values include: + * 'StorageAccessKey', 'SharedAccessKey'. + */ + @JsonProperty(value = "properties.storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /** + * The storage key to use. If storage key type is SharedAccessKey, it must + * be preceded with a "?.". + */ + @JsonProperty(value = "properties.storageKey", required = true) + private String storageKey; + + /** + * The storage uri to use. + */ + @JsonProperty(value = "properties.storageUri", required = true) + private String storageUri; + + /** + * The name of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLogin", required = true) + private String administratorLogin; + + /** + * The password of the SQL administrator. + */ + @JsonProperty(value = "properties.administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * The authentication type. Possible values include: 'SQL', 'ADPassword'. + */ + @JsonProperty(value = "properties.authenticationType") + private AuthenticationType authenticationType; + + /** + * The type of import operation being performed. This is always Import. + */ + @JsonProperty(value = "properties.operationMode", required = true) + private String operationMode; + + /** + * Creates an instance of ImportExtensionRequest class. + */ + public ImportExtensionRequest() { + operationMode = "Import"; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Get the storageKeyType value. + * + * @return the storageKeyType value + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType value. + * + * @param storageKeyType the storageKeyType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey value. + * + * @return the storageKey value + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey value. + * + * @param storageKey the storageKey value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri value. + * + * @return the storageUri value + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri value. + * + * @param storageUri the storageUri value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType value. + * + * @return the authenticationType value + */ + public AuthenticationType authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType value. + * + * @param authenticationType the authenticationType value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withAuthenticationType(AuthenticationType authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the operationMode value. + * + * @return the operationMode value + */ + public String operationMode() { + return this.operationMode; + } + + /** + * Set the operationMode value. + * + * @param operationMode the operationMode value to set + * @return the ImportExtensionRequest object itself. + */ + public ImportExtensionRequest withOperationMode(String operationMode) { + this.operationMode = operationMode; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportRequest.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportRequest.java new file mode 100644 index 00000000000..4ce11244ff3 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ImportRequest.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Import database parameters. + */ +public class ImportRequest extends ExportRequest { + /** + * The name of the database to import. + */ + @JsonProperty(value = "databaseName", required = true) + private String databaseName; + + /** + * The edition for the database being created. Possible values include: + * 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', + * 'Stretch', 'DataWarehouse', 'System', 'System2'. + */ + @JsonProperty(value = "edition", required = true) + private DatabaseEdition edition; + + /** + * The name of the service objective to assign to the database. Possible + * values include: 'System', 'System0', 'System1', 'System2', 'System3', + * 'System4', 'System2L', 'System3L', 'System4L', 'Free', 'Basic', 'S0', + * 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', + * 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', + * 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', + * 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool'. + */ + @JsonProperty(value = "serviceObjectiveName", required = true) + private ServiceObjectiveName serviceObjectiveName; + + /** + * The maximum size for the newly imported database. + */ + @JsonProperty(value = "maxSizeBytes", required = true) + private String maxSizeBytes; + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName value. + * + * @param databaseName the databaseName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition value. + * + * @return the edition value + */ + public DatabaseEdition edition() { + return this.edition; + } + + /** + * Set the edition value. + * + * @param edition the edition value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withEdition(DatabaseEdition edition) { + this.edition = edition; + return this; + } + + /** + * Get the serviceObjectiveName value. + * + * @return the serviceObjectiveName value + */ + public ServiceObjectiveName serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the serviceObjectiveName value. + * + * @param serviceObjectiveName the serviceObjectiveName value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withServiceObjectiveName(ServiceObjectiveName serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maxSizeBytes value. + * + * @return the maxSizeBytes value + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes value. + * + * @param maxSizeBytes the maxSizeBytes value to set + * @return the ImportRequest object itself. + */ + public ImportRequest withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTarget.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTarget.java new file mode 100644 index 00000000000..2f94e3175b3 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/JobTarget.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.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A job target, for example a specific database or a container of databases + * that is evaluated during job execution. + */ +public class JobTarget { + /** + * Whether the target is included or excluded from the group. Possible + * values include: 'Include', 'Exclude'. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /** + * The target type. Possible values include: 'TargetGroup', 'SqlDatabase', + * 'SqlElasticPool', 'SqlShardMap', 'SqlServer'. + */ + @JsonProperty(value = "type", required = true) + private JobTargetType type; + + /** + * The target server name. + */ + @JsonProperty(value = "serverName") + private String serverName; + + /** + * The target database name. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /** + * The target elastic pool name. + */ + @JsonProperty(value = "elasticPoolName") + private String elasticPoolName; + + /** + * The target shard map. + */ + @JsonProperty(value = "shardMapName") + private String shardMapName; + + /** + * The resource ID of the credential that is used during job execution to + * connect to the target and determine the list of databases inside the + * target. + */ + @JsonProperty(value = "refreshCredential") + private String refreshCredential; + + /** + * Get the membershipType value. + * + * @return the membershipType value + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set the membershipType value. + * + * @param membershipType the membershipType value to set + * @return the JobTarget object itself. + */ + public JobTarget withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the type value. + * + * @return the type value + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the type value. + * + * @param type the type value to set + * @return the JobTarget object itself. + */ + public JobTarget withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the serverName value. + * + * @return the serverName value + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName value. + * + * @param serverName the serverName value to set + * @return the JobTarget object itself. + */ + public JobTarget withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName value. + * + * @return the databaseName value + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName value. + * + * @param databaseName the databaseName value to set + * @return the JobTarget object itself. + */ + public JobTarget withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the elasticPoolName value. + * + * @return the elasticPoolName value + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the elasticPoolName value. + * + * @param elasticPoolName the elasticPoolName value to set + * @return the JobTarget object itself. + */ + public JobTarget withElasticPoolName(String elasticPoolName) { + this.elasticPoolName = elasticPoolName; + return this; + } + + /** + * Get the shardMapName value. + * + * @return the shardMapName value + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the shardMapName value. + * + * @param shardMapName the shardMapName value to set + * @return the JobTarget object itself. + */ + public JobTarget withShardMapName(String shardMapName) { + this.shardMapName = shardMapName; + return this; + } + + /** + * Get the refreshCredential value. + * + * @return the refreshCredential value + */ + public String refreshCredential() { + return this.refreshCredential; + } + + /** + * Set the refreshCredential value. + * + * @param refreshCredential the refreshCredential value to set + * @return the JobTarget object itself. + */ + public JobTarget withRefreshCredential(String refreshCredential) { + this.refreshCredential = refreshCredential; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseUpdate.java new file mode 100644 index 00000000000..5ab037cee36 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedDatabaseUpdate.java @@ -0,0 +1,319 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An managed database update. + */ +@JsonFlatten +public class ManagedDatabaseUpdate { + /** + * Collation of the managed database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Status for the database. Possible values include: 'Online', 'Offline', + * 'Shutdown', 'Creating', 'Inaccessible'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /** + * Creation date of the database. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "properties.earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private DateTime earliestRestorePoint; + + /** + * Conditional. If createMode is PointInTimeRestore, this value is + * required. Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database. + */ + @JsonProperty(value = "properties.restorePointInTime") + private DateTime restorePointInTime; + + /** + * Geo paired region. + */ + @JsonProperty(value = "properties.defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /** + * Collation of the metadata catalog. Possible values include: + * 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS'. + */ + @JsonProperty(value = "properties.catalogCollation") + private CatalogCollationType catalogCollation; + + /** + * Managed database create mode. PointInTimeRestore: Create a database by + * restoring a point in time backup of an existing database. + * SourceDatabaseName, SourceManagedInstanceName and PointInTime must be + * specified. RestoreExternalBackup: Create a database by restoring from + * external backup files. Collation, StorageContainerUri and + * StorageContainerSasToken must be specified. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore'. + */ + @JsonProperty(value = "properties.createMode") + private ManagedDatabaseCreateMode createMode; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the uri of the storage container where backups for + * this restore are stored. + */ + @JsonProperty(value = "properties.storageContainerUri") + private String storageContainerUri; + + /** + * The resource identifier of the source database associated with create + * operation of this database. + */ + @JsonProperty(value = "properties.sourceDatabaseId") + private String sourceDatabaseId; + + /** + * Conditional. If createMode is RestoreExternalBackup, this value is + * required. Specifies the storage container sas token. + */ + @JsonProperty(value = "properties.storageContainerSasToken") + private String storageContainerSasToken; + + /** + * Instance Failover Group resource identifier that this managed database + * belongs to. + */ + @JsonProperty(value = "properties.failoverGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String failoverGroupId; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the collation value. + * + * @return the collation value + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation value. + * + * @param collation the collation value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status value. + * + * @return the status value + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate value. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint value. + * + * @return the earliestRestorePoint value + */ + public DateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime value. + * + * @return the restorePointInTime value + */ + public DateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime value. + * + * @param restorePointInTime the restorePointInTime value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorePointInTime(DateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation value. + * + * @return the defaultSecondaryLocation value + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation value. + * + * @return the catalogCollation value + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation value. + * + * @param catalogCollation the catalogCollation value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode value. + * + * @return the createMode value + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode value. + * + * @param createMode the createMode value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri value. + * + * @return the storageContainerUri value + */ + public String storageContainerUri() { + return this.storageContainerUri; + } + + /** + * Set the storageContainerUri value. + * + * @param storageContainerUri the storageContainerUri value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId value. + * + * @return the sourceDatabaseId value + */ + public String sourceDatabaseId() { + return this.sourceDatabaseId; + } + + /** + * Set the sourceDatabaseId value. + * + * @param sourceDatabaseId the sourceDatabaseId value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the storageContainerSasToken value. + * + * @return the storageContainerSasToken value + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken value. + * + * @param storageContainerSasToken the storageContainerSasToken value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId value. + * + * @return the failoverGroupId value + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstanceUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstanceUpdate.java new file mode 100644 index 00000000000..86ae30e7377 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ManagedInstanceUpdate.java @@ -0,0 +1,261 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database managed instance. + */ +@JsonFlatten +public class ManagedInstanceUpdate { + /** + * Managed instance sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Administrator username for the managed instance. Can only be specified + * when the managed instance is being created (and is required for + * creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for managed instance + * creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "properties.subnetId") + private String subnetId; + + /** + * The state of the managed instance. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The license type. Possible values are 'LicenseIncluded' and 'BasePrice'. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * The number of VCores. + */ + @JsonProperty(value = "properties.vCores") + private Integer vCores; + + /** + * The maximum storage size in GB. + */ + @JsonProperty(value = "properties.storageSizeInGB") + private Integer storageSizeInGB; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the fullyQualifiedDomainName value. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId value. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId value. + * + * @param subnetId the subnetId value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores value. + * + * @return the vCores value + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores value. + * + * @param vCores the vCores value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB value. + * + * @return the storageSizeInGB value + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB value. + * + * @param storageSizeInGB the storageSizeInGB value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServerUpdate.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServerUpdate.java new file mode 100644 index 00000000000..a6fbd478151 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServerUpdate.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * An update request for an Azure SQL Database server. + */ +@JsonFlatten +public class ServerUpdate { + /** + * Administrator username for the server. Once created it cannot be + * changed. + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /** + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /** + * The version of the server. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The state of the server. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the administratorLogin value. + * + * @return the administratorLogin value + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin value. + * + * @param administratorLogin the administratorLogin value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword value. + * + * @return the administratorLoginPassword value + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword value. + * + * @param administratorLoginPassword the administratorLoginPassword value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version value. + * + * @param version the version value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state value. + * + * @return the state value + */ + public String state() { + return this.state; + } + + /** + * Get the fullyQualifiedDomainName value. + * + * @return the fullyQualifiedDomainName value + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentRecurringScansProperties.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 00000000000..92e369ca950 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentRecurringScansProperties.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.sql; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a Vulnerability Assessment recurring scans. + */ +public class VulnerabilityAssessmentRecurringScansProperties { + /** + * Recurring scans state. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies that the schedule scan notification will be is sent to the + * subscription administrators. + */ + @JsonProperty(value = "emailSubscriptionAdmins") + private Boolean emailSubscriptionAdmins; + + /** + * Specifies an array of e-mail addresses to which the scan notification is + * sent. + */ + @JsonProperty(value = "emails") + private List emails; + + /** + * Get the isEnabled value. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled value. + * + * @param isEnabled the isEnabled value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the emailSubscriptionAdmins value. + * + * @return the emailSubscriptionAdmins value + */ + public Boolean emailSubscriptionAdmins() { + return this.emailSubscriptionAdmins; + } + + /** + * Set the emailSubscriptionAdmins value. + * + * @param emailSubscriptionAdmins the emailSubscriptionAdmins value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmailSubscriptionAdmins(Boolean emailSubscriptionAdmins) { + this.emailSubscriptionAdmins = emailSubscriptionAdmins; + return this; + } + + /** + * Get the emails value. + * + * @return the emails value + */ + public List emails() { + return this.emails; + } + + /** + * Set the emails value. + * + * @param emails the emails value to set + * @return the VulnerabilityAssessmentRecurringScansProperties object itself. + */ + public VulnerabilityAssessmentRecurringScansProperties withEmails(List emails) { + this.emails = emails; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanError.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanError.java new file mode 100644 index 00000000000..658ad5ec29b --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanError.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.sql; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a vulnerability assessment scan error. + */ +public class VulnerabilityAssessmentScanError { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the code value. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the message value. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanState.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanState.java new file mode 100644 index 00000000000..0273c4f129c --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanState.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanState. + */ +public final class VulnerabilityAssessmentScanState extends ExpandableStringEnum { + /** Static value Passed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState PASSED = fromString("Passed"); + + /** Static value Failed for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED = fromString("Failed"); + + /** Static value FailedToRun for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState FAILED_TO_RUN = fromString("FailedToRun"); + + /** Static value InProgress for VulnerabilityAssessmentScanState. */ + public static final VulnerabilityAssessmentScanState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a VulnerabilityAssessmentScanState from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanState + */ + @JsonCreator + public static VulnerabilityAssessmentScanState fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanState.class); + } + + /** + * @return known VulnerabilityAssessmentScanState values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanTriggerType.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 00000000000..4eed993c92b --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/VulnerabilityAssessmentScanTriggerType.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.sql; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VulnerabilityAssessmentScanTriggerType. + */ +public final class VulnerabilityAssessmentScanTriggerType extends ExpandableStringEnum { + /** Static value OnDemand for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType ON_DEMAND = fromString("OnDemand"); + + /** Static value Recurring for VulnerabilityAssessmentScanTriggerType. */ + public static final VulnerabilityAssessmentScanTriggerType RECURRING = fromString("Recurring"); + + /** + * Creates or finds a VulnerabilityAssessmentScanTriggerType from its string representation. + * @param name a name to look for + * @return the corresponding VulnerabilityAssessmentScanTriggerType + */ + @JsonCreator + public static VulnerabilityAssessmentScanTriggerType fromString(String name) { + return fromString(name, VulnerabilityAssessmentScanTriggerType.class); + } + + /** + * @return known VulnerabilityAssessmentScanTriggerType values + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DataMaskingRulesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DataMaskingRulesInner.java index 00e831ff8d9..3c3b05a7e52 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DataMaskingRulesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DataMaskingRulesInner.java @@ -250,7 +250,11 @@ public Observable>> listByDatabaseWit public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseUsagesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseUsagesInner.java index dd9689f4c0e..7ef08095ca1 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseUsagesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseUsagesInner.java @@ -134,7 +134,11 @@ public Observable>> listByDatabaseWithS public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 00000000000..d29a95cc0e0 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database vulnerability assessment. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentInner extends ProxyResourceInner { + /** + * A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "properties.storageContainerPath") + private String storageContainerPath; + + /** + * A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. + */ + @JsonProperty(value = "properties.storageContainerSasKey") + private String storageContainerSasKey; + + /** + * The recurring scans settings. + */ + @JsonProperty(value = "properties.recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** + * Get the storageContainerPath value. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Set the storageContainerPath value. + * + * @param storageContainerPath the storageContainerPath value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey value. + * + * @return the storageContainerSasKey value + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey value. + * + * @param storageContainerSasKey the storageContainerSasKey value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the recurringScans value. + * + * @return the recurringScans value + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans value. + * + * @param recurringScans the recurringScans value to set + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 00000000000..e3e0f28e539 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselineInner.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.sql.implementation; + +import java.util.List; +import com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database vulnerability assessment rule baseline. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResourceInner { + /** + * The rule baseline result. + */ + @JsonProperty(value = "properties.baselineResults", required = true) + private List baselineResults; + + /** + * Get the baselineResults value. + * + * @return the baselineResults value + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the baselineResults value. + * + * @param baselineResults the baselineResults value to set + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults(List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java new file mode 100644 index 00000000000..de877afbbd0 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java @@ -0,0 +1,383 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseVulnerabilityAssessmentRuleBaselines. + */ +public class DatabaseVulnerabilityAssessmentRuleBaselinesInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentRuleBaselinesService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentRuleBaselinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentRuleBaselinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentRuleBaselines to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessmentRuleBaselines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") String baselineName, @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.sql.DatabaseVulnerabilityAssessmentRuleBaselines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") String baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessmentRuleBaselines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("ruleId") String ruleId, @Path("baselineName") String baselineName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner get(String resourceGroupName, String serverName, String databaseName, String ruleId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId).toBlocking().single().body(); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @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 serverName, String databaseName, String ruleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId), serviceCallback); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String ruleId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String baselineName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineResults The rule baseline result + * @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 DatabaseVulnerabilityAssessmentRuleBaselineInner object if successful. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String ruleId, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineResults).toBlocking().single().body(); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineResults The rule baseline result + * @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 serverName, String databaseName, String ruleId, List baselineResults, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineResults), serviceCallback); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, List baselineResults) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineResults).map(new Func1, DatabaseVulnerabilityAssessmentRuleBaselineInner>() { + @Override + public DatabaseVulnerabilityAssessmentRuleBaselineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @param baselineResults The rule baseline result + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentRuleBaselineInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId, List baselineResults) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId 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 (baselineResults == null) { + throw new IllegalArgumentException("Parameter baselineResults is required and cannot be null."); + } + Validator.validate(baselineResults); + final String vulnerabilityAssessmentName = "default"; + final String baselineName = "default"; + final String apiVersion = "2017-03-01-preview"; + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + parameters.withBaselineResults(baselineResults); + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, 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); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @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 serverName, String databaseName, String ruleId) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @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 serverName, String databaseName, String ruleId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName, String ruleId) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String ruleId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (ruleId == null) { + throw new IllegalArgumentException("Parameter ruleId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String baselineName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 00000000000..fecf64a1054 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A database Vulnerability Assessment scan export resource. + */ +@JsonFlatten +public class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResourceInner { + /** + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "properties.exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** + * Get the exportedReportLocation value. + * + * @return the exportedReportLocation value + */ + public String exportedReportLocation() { + return this.exportedReportLocation; + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansInner.java new file mode 100644 index 00000000000..57f6040d72d --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentScansInner.java @@ -0,0 +1,707 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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 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.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseVulnerabilityAssessmentScans. + */ +public class DatabaseVulnerabilityAssessmentScansInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentScansService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentScansInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentScansService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessmentScans to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentScansService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessmentScans get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.sql.DatabaseVulnerabilityAssessmentScans execute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> execute(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.sql.DatabaseVulnerabilityAssessmentScans beginExecute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + Observable> beginExecute(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.sql.DatabaseVulnerabilityAssessmentScans listByDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + Observable> listByDatabase(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.sql.DatabaseVulnerabilityAssessmentScans export" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export") + Observable> export(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("scanId") String scanId, @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.sql.DatabaseVulnerabilityAssessmentScans listByDatabaseNext" }) + @GET + Observable> listByDatabaseNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 VulnerabilityAssessmentScanRecordInner object if successful. + */ + public VulnerabilityAssessmentScanRecordInner get(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan 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 serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, VulnerabilityAssessmentScanRecordInner>() { + @Override + public VulnerabilityAssessmentScanRecordInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VulnerabilityAssessmentScanRecordInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (scanId == null) { + throw new IllegalArgumentException("Parameter scanId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-10-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 execute(String resourceGroupName, String serverName, String databaseName, String scanId) { + executeWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().last().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan 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 executeAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(executeWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable executeAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return executeWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> executeWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (scanId == null) { + throw new IllegalArgumentException("Parameter scanId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-10-01-preview"; + Observable> observable = service.execute(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @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 beginExecute(String resourceGroupName, String serverName, String databaseName, String scanId) { + beginExecuteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan 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 beginExecuteAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExecuteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginExecuteAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return beginExecuteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginExecuteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (scanId == null) { + throw new IllegalArgumentException("Parameter scanId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-10-01-preview"; + return service.beginExecute(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExecuteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExecuteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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 PagedList<VulnerabilityAssessmentScanRecordInner> object if successful. + */ + public PagedList listByDatabase(final String resourceGroupName, final String serverName, final String databaseName) { + ServiceResponse> response = listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @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> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable>> listByDatabaseWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName) { + return listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + ServiceResponse> * @param serverName The name of the server. + ServiceResponse> * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseSinglePageAsync(final String resourceGroupName, final String serverName, final String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-10-01-preview"; + return service.listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseDelegate(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); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 DatabaseVulnerabilityAssessmentScansExportInner object if successful. + */ + public DatabaseVulnerabilityAssessmentScansExportInner export(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).toBlocking().single().body(); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param scanId The vulnerability assessment scan Id. + * @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 exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId), serviceCallback); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, scanId).map(new Func1, DatabaseVulnerabilityAssessmentScansExportInner>() { + @Override + public DatabaseVulnerabilityAssessmentScansExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Convert an existing scan result to a human readable format. If already exists nothing happens. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the scanned database. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object + */ + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (scanId == null) { + throw new IllegalArgumentException("Parameter scanId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-10-01-preview"; + return service.export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = exportDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse exportDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<VulnerabilityAssessmentScanRecordInner> object if successful. + */ + public PagedList listByDatabaseNext(final String nextPageLink) { + ServiceResponse> response = listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDatabaseNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDatabaseNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable> listByDatabaseNextAsync(final String nextPageLink) { + return listByDatabaseNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VulnerabilityAssessmentScanRecordInner> object + */ + public Observable>> listByDatabaseNextWithServiceResponseAsync(final String nextPageLink) { + return listByDatabaseNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDatabaseNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VulnerabilityAssessmentScanRecordInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDatabaseNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDatabaseNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDatabaseNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentsInner.java new file mode 100644 index 00000000000..70ed55fda97 --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabaseVulnerabilityAssessmentsInner.java @@ -0,0 +1,356 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseVulnerabilityAssessments. + */ +public class DatabaseVulnerabilityAssessmentsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseVulnerabilityAssessmentsService service; + /** The service client containing this operation class. */ + private SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseVulnerabilityAssessmentsInner(Retrofit retrofit, SqlManagementClientImpl client) { + this.service = retrofit.create(DatabaseVulnerabilityAssessmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseVulnerabilityAssessments to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseVulnerabilityAssessmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @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.sql.DatabaseVulnerabilityAssessments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Body DatabaseVulnerabilityAssessmentInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.DatabaseVulnerabilityAssessments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("vulnerabilityAssessmentName") String vulnerabilityAssessmentName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @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 DatabaseVulnerabilityAssessmentInner object if successful. + */ + public DatabaseVulnerabilityAssessmentInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param parameters The requested 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 createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseVulnerabilityAssessmentInner>() { + @Override + public DatabaseVulnerabilityAssessmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseVulnerabilityAssessmentInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.createOrUpdate(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 serverName, String databaseName) { + deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @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 serverName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName), serviceCallback); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Removes the database's vulnerability assessment. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (serverName == null) { + throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); + } + if (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String vulnerabilityAssessmentName = "default"; + final String apiVersion = "2017-03-01-preview"; + return service.delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java index 765ad82edb2..0e3c908dff7 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java @@ -13,6 +13,10 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.DatabaseUpdate; +import com.microsoft.azure.management.sql.ExportRequest; +import com.microsoft.azure.management.sql.ImportExtensionRequest; +import com.microsoft.azure.management.sql.ImportRequest; import com.microsoft.azure.management.sql.ResourceMoveDefinition; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -66,27 +70,27 @@ public DatabasesInner(Retrofit retrofit, SqlManagementClientImpl client) { interface DatabasesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Databases importMethod" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") - Observable> importMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> importMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.sql.Databases beginImportMethod" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/import") - Observable> beginImportMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginImportMethod(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Query("api-version") String apiVersion, @Body ImportRequest 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.sql.Databases createImportOperation" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") - Observable> createImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.sql.Databases beginCreateImportOperation" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extensions/{extensionName}") - Observable> beginCreateImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginCreateImportOperation(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("extensionName") String extensionName, @Query("api-version") String apiVersion, @Body ImportExtensionRequest 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.sql.Databases export" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") - Observable> export(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> export(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.sql.Databases beginExport" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/export") - Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequestInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginExport(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ExportRequest 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.sql.Databases listMetrics" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/metrics") @@ -130,11 +134,11 @@ interface DatabasesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Databases update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Databases beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body DatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Databases listByElasticPool" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases") @@ -181,7 +185,7 @@ interface DatabasesService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner importMethod(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public ImportExportResponseInner importMethod(String resourceGroupName, String serverName, ImportRequest parameters) { return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); } @@ -195,7 +199,7 @@ public ImportExportResponseInner importMethod(String resourceGroupName, String s * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture importMethodAsync(String resourceGroupName, String serverName, ImportRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -208,7 +212,7 @@ public ServiceFuture importMethodAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public Observable importMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { return importMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -226,7 +230,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public Observable> importMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -256,7 +260,7 @@ public Observable> importMethodWithSe * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner beginImportMethod(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public ImportExportResponseInner beginImportMethod(String resourceGroupName, String serverName, ImportRequest parameters) { return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); } @@ -270,7 +274,7 @@ public ImportExportResponseInner beginImportMethod(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -283,7 +287,7 @@ public ServiceFuture beginImportMethodAsync(String re * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public Observable beginImportMethodAsync(String resourceGroupName, String serverName, ImportRequest parameters) { return beginImportMethodWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -301,7 +305,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable> beginImportMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequestInner parameters) { + public Observable> beginImportMethodWithServiceResponseAsync(String resourceGroupName, String serverName, ImportRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -350,7 +354,7 @@ private ServiceResponse beginImportMethodDelegate(Res * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public ImportExportResponseInner createImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); } @@ -365,7 +369,7 @@ public ImportExportResponseInner createImportOperation(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -379,7 +383,7 @@ public ServiceFuture createImportOperationAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public Observable createImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return createImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -398,7 +402,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> createImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public Observable> createImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -433,7 +437,7 @@ public Observable> createImportOperat * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner beginCreateImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public ImportExportResponseInner beginCreateImportOperation(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); } @@ -448,7 +452,7 @@ public ImportExportResponseInner beginCreateImportOperation(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -462,7 +466,7 @@ public ServiceFuture beginCreateImportOperationAsync( * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public Observable beginCreateImportOperationAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { return beginCreateImportOperationWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -481,7 +485,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable> beginCreateImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequestInner parameters) { + public Observable> beginCreateImportOperationWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ImportExtensionRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -534,7 +538,7 @@ private ServiceResponse beginCreateImportOperationDel * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner export(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public ImportExportResponseInner export(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); } @@ -549,7 +553,7 @@ public ImportExportResponseInner export(String resourceGroupName, String serverN * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -563,7 +567,7 @@ public ServiceFuture exportAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public Observable exportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { return exportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -582,7 +586,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public Observable> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -616,7 +620,7 @@ public Observable> exportWithServiceR * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ImportExportResponseInner object if successful. */ - public ImportExportResponseInner beginExport(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public ImportExportResponseInner beginExport(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); } @@ -631,7 +635,7 @@ public ImportExportResponseInner beginExport(String resourceGroupName, String se * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -645,7 +649,7 @@ public ServiceFuture beginExportAsync(String resource * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public Observable beginExportAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, ImportExportResponseInner>() { @Override public ImportExportResponseInner call(ServiceResponse response) { @@ -664,7 +668,7 @@ public ImportExportResponseInner call(ServiceResponse * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ImportExportResponseInner object */ - public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequestInner parameters) { + public Observable> beginExportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, ExportRequest parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -787,7 +791,11 @@ public Observable>> listMetricsWithServiceResp public Observable>> call(Response response) { try { ServiceResponse> result = listMetricsDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -879,7 +887,11 @@ public Observable>> listMetricDefini public Observable>> call(Response response) { try { ServiceResponse> result = listMetricDefinitionsDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -1631,7 +1643,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the DatabaseInner object if successful. */ - public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body(); } @@ -1646,7 +1658,7 @@ public DatabaseInner update(String resourceGroupName, String serverName, String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -1660,7 +1672,7 @@ public ServiceFuture updateAsync(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { @Override public DatabaseInner call(ServiceResponse response) { @@ -1679,7 +1691,7 @@ public DatabaseInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1713,7 +1725,7 @@ public Observable> updateWithServiceResponseAsync * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the DatabaseInner object if successful. */ - public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public DatabaseInner beginUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body(); } @@ -1728,7 +1740,7 @@ public DatabaseInner beginUpdate(String resourceGroupName, String serverName, St * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters), serviceCallback); } @@ -1742,7 +1754,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1, DatabaseInner>() { @Override public DatabaseInner call(ServiceResponse response) { @@ -1761,7 +1773,7 @@ public DatabaseInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DatabaseInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivitiesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivitiesInner.java index edab75d13e3..04124c54927 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivitiesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolActivitiesInner.java @@ -134,7 +134,11 @@ public Observable>> listByElastic public Observable>> call(Response response) { try { ServiceResponse> result = listByElasticPoolDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolDatabaseActivitiesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolDatabaseActivitiesInner.java index a82fc6f73ed..cd02a3c8348 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolDatabaseActivitiesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolDatabaseActivitiesInner.java @@ -134,7 +134,11 @@ public Observable>> listB public Observable>> call(Response response) { try { ServiceResponse> result = listByElasticPoolDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java index 1c108584033..878338ae446 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ElasticPoolsInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.ElasticPoolUpdate; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -96,11 +97,11 @@ interface ElasticPoolsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ElasticPools update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ElasticPools beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("elasticPoolName") String elasticPoolName, @Path("subscriptionId") String subscriptionId, @Body ElasticPoolUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ElasticPools listByServerNext" }) @GET @@ -191,7 +192,11 @@ public Observable>> listMetricsWithServiceResp public Observable>> call(Response response) { try { ServiceResponse> result = listMetricsDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -283,7 +288,11 @@ public Observable>> listMetricDefini public Observable>> call(Response response) { try { ServiceResponse> result = listMetricDefinitionsDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -991,7 +1000,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ElasticPoolInner object if successful. */ - public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public ElasticPoolInner update(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().last().body(); } @@ -1006,7 +1015,7 @@ public ElasticPoolInner update(String resourceGroupName, String serverName, Stri * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); } @@ -1020,7 +1029,7 @@ public ServiceFuture updateAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse response) { @@ -1039,7 +1048,7 @@ public ElasticPoolInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1073,7 +1082,7 @@ public Observable> updateWithServiceResponseAs * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ElasticPoolInner object if successful. */ - public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).toBlocking().single().body(); } @@ -1088,7 +1097,7 @@ public ElasticPoolInner beginUpdate(String resourceGroupName, String serverName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters), serviceCallback); } @@ -1102,7 +1111,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroupName * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ElasticPoolInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse response) { @@ -1121,7 +1130,7 @@ public ElasticPoolInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ElasticPoolInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FailoverGroupsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FailoverGroupsInner.java index 305a3baff22..ff25eed5b72 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FailoverGroupsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FailoverGroupsInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.FailoverGroupUpdate; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -85,11 +86,11 @@ interface FailoverGroupsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.FailoverGroups update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.FailoverGroups beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("failoverGroupName") String failoverGroupName, @Path("subscriptionId") String subscriptionId, @Body FailoverGroupUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.FailoverGroups listByServer" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/failoverGroups") @@ -568,7 +569,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FailoverGroupInner object if successful. */ - public FailoverGroupInner update(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public FailoverGroupInner update(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().last().body(); } @@ -583,7 +584,7 @@ public FailoverGroupInner update(String resourceGroupName, String serverName, St * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); } @@ -597,7 +598,7 @@ public ServiceFuture updateAsync(String resourceGroupName, S * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse response) { @@ -616,7 +617,7 @@ public FailoverGroupInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -650,7 +651,7 @@ public Observable> updateWithServiceResponse * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the FailoverGroupInner object if successful. */ - public FailoverGroupInner beginUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public FailoverGroupInner beginUpdate(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).toBlocking().single().body(); } @@ -665,7 +666,7 @@ public FailoverGroupInner beginUpdate(String resourceGroupName, String serverNam * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters), serviceCallback); } @@ -679,7 +680,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroupNa * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FailoverGroupInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters).map(new Func1, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse response) { @@ -698,7 +699,7 @@ public FailoverGroupInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the FailoverGroupInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRulesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRulesInner.java index e9e1ed6cafb..bf52c95e4ad 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRulesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/FirewallRulesInner.java @@ -425,7 +425,11 @@ public Observable>> listByServerWithServ public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/GeoBackupPoliciesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/GeoBackupPoliciesInner.java index 3e7a707dace..b2baa84cf6b 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/GeoBackupPoliciesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/GeoBackupPoliciesInner.java @@ -339,7 +339,11 @@ public Observable>> listByDatabaseWit public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java index b7b69073308..73784441b99 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.management.sql.implementation; import java.util.List; +import com.microsoft.azure.management.sql.JobTarget; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; @@ -21,14 +22,14 @@ public class JobTargetGroupInner extends ProxyResourceInner { * Members of the target group. */ @JsonProperty(value = "properties.members", required = true) - private List members; + private List members; /** * Get the members value. * * @return the members value */ - public List members() { + public List members() { return this.members; } @@ -38,7 +39,7 @@ public List members() { * @param members the members value to set * @return the JobTargetGroupInner object itself. */ - public JobTargetGroupInner withMembers(List members) { + public JobTargetGroupInner withMembers(List members) { this.members = members; return this; } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java index 0f968eb9cae..34bec391351 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/JobTargetGroupsInner.java @@ -13,6 +13,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.JobTarget; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -323,7 +324,7 @@ private ServiceResponse getDelegate(Response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the JobTargetGroupInner object if successful. */ - public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).toBlocking().single().body(); } @@ -339,7 +340,7 @@ public JobTargetGroupInner createOrUpdate(String resourceGroupName, String serve * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members, final ServiceCallback serviceCallback) { + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members), serviceCallback); } @@ -354,7 +355,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGro * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the JobTargetGroupInner object */ - public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + public Observable createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, members).map(new Func1, JobTargetGroupInner>() { @Override public JobTargetGroupInner call(ServiceResponse response) { @@ -374,7 +375,7 @@ public JobTargetGroupInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the JobTargetGroupInner object */ - public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, List members) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java index 4e370c10d31..c0c7fabb7c1 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedDatabasesInner.java @@ -14,6 +14,7 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.sql.CompleteDatabaseRestoreDefinition; +import com.microsoft.azure.management.sql.ManagedDatabaseUpdate; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -99,11 +100,11 @@ interface ManagedDatabasesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("databaseName") String databaseName, @Path("subscriptionId") String subscriptionId, @Body ManagedDatabaseUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedDatabases listByInstanceNext" }) @GET @@ -851,7 +852,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ManagedDatabaseInner object if successful. */ - public ManagedDatabaseInner update(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public ManagedDatabaseInner update(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().last().body(); } @@ -866,7 +867,7 @@ public ManagedDatabaseInner update(String resourceGroupName, String managedInsta * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); } @@ -880,7 +881,7 @@ public ServiceFuture updateAsync(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse response) { @@ -899,7 +900,7 @@ public ManagedDatabaseInner call(ServiceResponse response) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -933,7 +934,7 @@ public Observable> updateWithServiceRespon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ManagedDatabaseInner object if successful. */ - public ManagedDatabaseInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public ManagedDatabaseInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).toBlocking().single().body(); } @@ -948,7 +949,7 @@ public ManagedDatabaseInner beginUpdate(String resourceGroupName, String managed * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters), serviceCallback); } @@ -962,7 +963,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ManagedDatabaseInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1, ManagedDatabaseInner>() { @Override public ManagedDatabaseInner call(ServiceResponse response) { @@ -981,7 +982,7 @@ public ManagedDatabaseInner call(ServiceResponse response) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ManagedDatabaseInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java index 5b2c7bea3a4..66d46fc1c6d 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ManagedInstancesInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.sql.ManagedInstanceUpdate; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -95,11 +96,11 @@ interface ManagedInstancesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedInstances update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedInstances beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Body ManagedInstanceUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.ManagedInstances listNext" }) @GET @@ -744,7 +745,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ManagedInstanceInner object if successful. */ - public ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); } @@ -758,7 +759,7 @@ public ManagedInstanceInner update(String resourceGroupName, String managedInsta * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); } @@ -771,7 +772,7 @@ public ServiceFuture updateAsync(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { @Override public ManagedInstanceInner call(ServiceResponse response) { @@ -789,7 +790,7 @@ public ManagedInstanceInner call(ServiceResponse response) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -819,7 +820,7 @@ public Observable> updateWithServiceRespon * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ManagedInstanceInner object if successful. */ - public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body(); } @@ -833,7 +834,7 @@ public ManagedInstanceInner beginUpdate(String resourceGroupName, String managed * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters), serviceCallback); } @@ -846,7 +847,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ManagedInstanceInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1, ManagedInstanceInner>() { @Override public ManagedInstanceInner call(ServiceResponse response) { @@ -864,7 +865,7 @@ public ManagedInstanceInner call(ServiceResponse response) * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ManagedInstanceInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ProxyResourceInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ProxyResourceInner.java index f0c8004921e..5aab695720d 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ProxyResourceInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ProxyResourceInner.java @@ -8,10 +8,10 @@ package com.microsoft.azure.management.sql.implementation; -import com.microsoft.azure.Resource; +import com.microsoft.azure.ProxyResource; /** * ARM proxy resource. */ -public class ProxyResourceInner extends Resource { +public class ProxyResourceInner extends ProxyResource { } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecommendedElasticPoolsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecommendedElasticPoolsInner.java index 20cb1705d32..9de51c7b9ca 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecommendedElasticPoolsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecommendedElasticPoolsInner.java @@ -226,7 +226,11 @@ public Observable>> listByServ public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); @@ -318,7 +322,11 @@ public Observable>> list public Observable>> call(Response response) { try { ServiceResponse> result = listMetricsDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecoverableDatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecoverableDatabasesInner.java index 0c5b8b0afe8..9d6b5f221a4 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecoverableDatabasesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RecoverableDatabasesInner.java @@ -222,7 +222,11 @@ public Observable>> listByServerW public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ReplicationLinksInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ReplicationLinksInner.java index 4438a6e8c04..2c6924dd9a7 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ReplicationLinksInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ReplicationLinksInner.java @@ -712,7 +712,11 @@ public Observable>> listByDatabaseWit public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorableDroppedDatabasesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorableDroppedDatabasesInner.java index c313e344164..e6b46876618 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorableDroppedDatabasesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorableDroppedDatabasesInner.java @@ -222,7 +222,11 @@ public Observable>> listByS public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorePointsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorePointsInner.java index 4893d3f1c9a..319e6d245a2 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorePointsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/RestorePointsInner.java @@ -154,7 +154,11 @@ public Observable>> listByDatabaseWithSe public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerAzureADAdministratorsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerAzureADAdministratorsInner.java index 4fe58896254..26df8fb94d3 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerAzureADAdministratorsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerAzureADAdministratorsInner.java @@ -563,7 +563,11 @@ public Observable>> listBy public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerCommunicationLinksInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerCommunicationLinksInner.java index 7e5b3e82ea4..4b3173eab4a 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerCommunicationLinksInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerCommunicationLinksInner.java @@ -511,7 +511,11 @@ public Observable>> listBySer public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java index effc67453fb..1cf9112976a 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServerUsagesInner.java @@ -127,7 +127,11 @@ public Observable>> listByServerWithServi public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java index f80206e718e..0d0b594d7c7 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServersInner.java @@ -17,6 +17,7 @@ import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.sql.CheckNameAvailabilityRequest; +import com.microsoft.azure.management.sql.ServerUpdate; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -101,11 +102,11 @@ interface ServersService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Servers update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Servers beginUpdate" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}") - Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdateInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("serverName") String serverName, @Path("subscriptionId") String subscriptionId, @Body ServerUpdate parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.Servers listNext" }) @GET @@ -829,7 +830,7 @@ private ServiceResponse beginDeleteDelegate(Response respons * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner update(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().last().body(); } @@ -843,7 +844,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerUpd * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture updateAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -856,7 +857,7 @@ public ServiceFuture updateAsync(String resourceGroupName, String s * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public Observable updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -874,7 +875,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -904,7 +905,7 @@ public Observable> updateWithServiceResponseAsync(S * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the ServerInner object if successful. */ - public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); } @@ -918,7 +919,7 @@ public ServerInner beginUpdate(String resourceGroupName, String serverName, Serv * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters, final ServiceCallback serviceCallback) { + public ServiceFuture beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdate parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters), serviceCallback); } @@ -931,7 +932,7 @@ public ServiceFuture beginUpdateAsync(String resourceGroupName, Str * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public Observable beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1, ServerInner>() { @Override public ServerInner call(ServiceResponse response) { @@ -949,7 +950,7 @@ public ServerInner call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ServerInner object */ - public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdateInner parameters) { + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceObjectivesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceObjectivesInner.java index 51958c05177..1fb3516f0c1 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceObjectivesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceObjectivesInner.java @@ -222,7 +222,11 @@ public Observable>> listByServerWith public Observable>> call(Response response) { try { ServiceResponse> result = listByServerDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceTierAdvisorsInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceTierAdvisorsInner.java index 56d95924a04..3e99c9ce65a 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceTierAdvisorsInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/ServiceTierAdvisorsInner.java @@ -236,7 +236,11 @@ public Observable>> listByDatabase public Observable>> call(Response response) { try { ServiceResponse> result = listByDatabaseDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java index 7bc6f025165..41718ee5c2e 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java @@ -575,6 +575,32 @@ public VirtualNetworkRulesInner virtualNetworkRules() { return this.virtualNetworkRules; } + /** + * The DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesInner object. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesInner databaseVulnerabilityAssessmentRuleBaselines() { + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * The DatabaseVulnerabilityAssessmentsInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments; + + /** + * Gets the DatabaseVulnerabilityAssessmentsInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentsInner object. + */ + public DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments() { + return this.databaseVulnerabilityAssessments; + } + /** * The LongTermRetentionBackupsInner object to access its operations. */ @@ -653,6 +679,123 @@ public RestorePointsInner restorePoints() { return this.restorePoints; } + /** + * The JobAgentsInner object to access its operations. + */ + private JobAgentsInner jobAgents; + + /** + * Gets the JobAgentsInner object to access its operations. + * @return the JobAgentsInner object. + */ + public JobAgentsInner jobAgents() { + return this.jobAgents; + } + + /** + * The JobCredentialsInner object to access its operations. + */ + private JobCredentialsInner jobCredentials; + + /** + * Gets the JobCredentialsInner object to access its operations. + * @return the JobCredentialsInner object. + */ + public JobCredentialsInner jobCredentials() { + return this.jobCredentials; + } + + /** + * The JobExecutionsInner object to access its operations. + */ + private JobExecutionsInner jobExecutions; + + /** + * Gets the JobExecutionsInner object to access its operations. + * @return the JobExecutionsInner object. + */ + public JobExecutionsInner jobExecutions() { + return this.jobExecutions; + } + + /** + * The JobsInner object to access its operations. + */ + private JobsInner jobs; + + /** + * Gets the JobsInner object to access its operations. + * @return the JobsInner object. + */ + public JobsInner jobs() { + return this.jobs; + } + + /** + * The JobStepExecutionsInner object to access its operations. + */ + private JobStepExecutionsInner jobStepExecutions; + + /** + * Gets the JobStepExecutionsInner object to access its operations. + * @return the JobStepExecutionsInner object. + */ + public JobStepExecutionsInner jobStepExecutions() { + return this.jobStepExecutions; + } + + /** + * The JobStepsInner object to access its operations. + */ + private JobStepsInner jobSteps; + + /** + * Gets the JobStepsInner object to access its operations. + * @return the JobStepsInner object. + */ + public JobStepsInner jobSteps() { + return this.jobSteps; + } + + /** + * The JobTargetExecutionsInner object to access its operations. + */ + private JobTargetExecutionsInner jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsInner object to access its operations. + * @return the JobTargetExecutionsInner object. + */ + public JobTargetExecutionsInner jobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** + * The JobTargetGroupsInner object to access its operations. + */ + private JobTargetGroupsInner jobTargetGroups; + + /** + * Gets the JobTargetGroupsInner object to access its operations. + * @return the JobTargetGroupsInner object. + */ + public JobTargetGroupsInner jobTargetGroups() { + return this.jobTargetGroups; + } + + /** + * The JobVersionsInner object to access its operations. + */ + private JobVersionsInner jobVersions; + + /** + * Gets the JobVersionsInner object to access its operations. + * @return the JobVersionsInner object. + */ + public JobVersionsInner jobVersions() { + return this.jobVersions; + } + /** * The DatabaseOperationsInner object to access its operations. */ @@ -692,6 +835,19 @@ public CapabilitiesInner capabilities() { return this.capabilities; } + /** + * The DatabaseVulnerabilityAssessmentScansInner object to access its operations. + */ + private DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansInner object to access its operations. + * @return the DatabaseVulnerabilityAssessmentScansInner object. + */ + public DatabaseVulnerabilityAssessmentScansInner databaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + /** * The InstanceFailoverGroupsInner object to access its operations. */ @@ -787,15 +943,27 @@ protected void initialize() { this.syncMembers = new SyncMembersInner(restClient().retrofit(), this); this.subscriptionUsages = new SubscriptionUsagesInner(restClient().retrofit(), this); this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); + this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); + this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); + this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); + this.jobs = new JobsInner(restClient().retrofit(), this); + this.jobStepExecutions = new JobStepExecutionsInner(restClient().retrofit(), this); + this.jobSteps = new JobStepsInner(restClient().retrofit(), this); + this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); + this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); + this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansInner(restClient().retrofit(), this); this.instanceFailoverGroups = new InstanceFailoverGroupsInner(restClient().retrofit(), this); this.shortTermRetentionPolicies = new ShortTermRetentionPoliciesInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TrackedResourceInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TrackedResourceInner.java index 158e4085424..fd00fead8d3 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TrackedResourceInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TrackedResourceInner.java @@ -10,12 +10,12 @@ import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; -import com.microsoft.azure.Resource; +import com.microsoft.azure.ProxyResource; /** * ARM tracked top level resource. */ -public class TrackedResourceInner extends Resource { +public class TrackedResourceInner extends ProxyResource { /** * Resource tags. */ diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TransparentDataEncryptionActivitiesInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TransparentDataEncryptionActivitiesInner.java index f35e4a2b3ab..57ec4132b80 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TransparentDataEncryptionActivitiesInner.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/TransparentDataEncryptionActivitiesInner.java @@ -135,7 +135,11 @@ public Observable>> public Observable>> call(Response response) { try { ServiceResponse> result = listByConfigurationDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.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); diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/VulnerabilityAssessmentScanRecordInner.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 00000000000..655549b516e --- /dev/null +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.sql.implementation; + +import com.microsoft.azure.management.sql.VulnerabilityAssessmentScanTriggerType; +import com.microsoft.azure.management.sql.VulnerabilityAssessmentScanState; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.sql.VulnerabilityAssessmentScanError; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A vulnerability assessment scan record. + */ +@JsonFlatten +public class VulnerabilityAssessmentScanRecordInner extends ProxyResourceInner { + /** + * The scan ID. + */ + @JsonProperty(value = "properties.scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /** + * The scan trigger type. Possible values include: 'OnDemand', 'Recurring'. + */ + @JsonProperty(value = "properties.triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /** + * The scan status. Possible values include: 'Passed', 'Failed', + * 'FailedToRun', 'InProgress'. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /** + * The scan start time (UTC). + */ + @JsonProperty(value = "properties.startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The scan end time (UTC). + */ + @JsonProperty(value = "properties.endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The scan errors. + */ + @JsonProperty(value = "properties.errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * The scan results storage container path. + */ + @JsonProperty(value = "properties.storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /** + * The number of failed security checks. + */ + @JsonProperty(value = "properties.numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** + * Get the scanId value. + * + * @return the scanId value + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the triggerType value. + * + * @return the triggerType value + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the state value. + * + * @return the state value + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the startTime value. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime value. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the errors value. + * + * @return the errors value + */ + public List errors() { + return this.errors; + } + + /** + * Get the storageContainerPath value. + * + * @return the storageContainerPath value + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the numberOfFailedSecurityChecks value. + * + * @return the numberOfFailedSecurityChecks value + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + +} From 9546d13e055c5da58b4a2ec36f33333a8c729fb4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 17 May 2018 20:35:40 +0000 Subject: [PATCH 4/4] Generated from a74684ba52dc7e4ea8b566425d98629cfcf4d01e Fixing readme.md based on feedback. Ordered jobs.json alphabetically in it's 2017-03-01-preview regions as well as removed comment for difference between v3 and v2 --- .../SqlManagementClientImpl.java | 168 +++++++++--------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java index 41718ee5c2e..3510dace93e 100644 --- a/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java +++ b/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/SqlManagementClientImpl.java @@ -601,84 +601,6 @@ public DatabaseVulnerabilityAssessmentsInner databaseVulnerabilityAssessments() return this.databaseVulnerabilityAssessments; } - /** - * The LongTermRetentionBackupsInner object to access its operations. - */ - private LongTermRetentionBackupsInner longTermRetentionBackups; - - /** - * Gets the LongTermRetentionBackupsInner object to access its operations. - * @return the LongTermRetentionBackupsInner object. - */ - public LongTermRetentionBackupsInner longTermRetentionBackups() { - return this.longTermRetentionBackups; - } - - /** - * The BackupLongTermRetentionPoliciesInner object to access its operations. - */ - private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; - - /** - * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. - * @return the BackupLongTermRetentionPoliciesInner object. - */ - public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { - return this.backupLongTermRetentionPolicies; - } - - /** - * The ManagedDatabasesInner object to access its operations. - */ - private ManagedDatabasesInner managedDatabases; - - /** - * Gets the ManagedDatabasesInner object to access its operations. - * @return the ManagedDatabasesInner object. - */ - public ManagedDatabasesInner managedDatabases() { - return this.managedDatabases; - } - - /** - * The ServerAutomaticTuningsInner object to access its operations. - */ - private ServerAutomaticTuningsInner serverAutomaticTunings; - - /** - * Gets the ServerAutomaticTuningsInner object to access its operations. - * @return the ServerAutomaticTuningsInner object. - */ - public ServerAutomaticTuningsInner serverAutomaticTunings() { - return this.serverAutomaticTunings; - } - - /** - * The ServerDnsAliasesInner object to access its operations. - */ - private ServerDnsAliasesInner serverDnsAliases; - - /** - * Gets the ServerDnsAliasesInner object to access its operations. - * @return the ServerDnsAliasesInner object. - */ - public ServerDnsAliasesInner serverDnsAliases() { - return this.serverDnsAliases; - } - - /** - * The RestorePointsInner object to access its operations. - */ - private RestorePointsInner restorePoints; - - /** - * Gets the RestorePointsInner object to access its operations. - * @return the RestorePointsInner object. - */ - public RestorePointsInner restorePoints() { - return this.restorePoints; - } - /** * The JobAgentsInner object to access its operations. */ @@ -796,6 +718,84 @@ public JobVersionsInner jobVersions() { return this.jobVersions; } + /** + * The LongTermRetentionBackupsInner object to access its operations. + */ + private LongTermRetentionBackupsInner longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsInner object to access its operations. + * @return the LongTermRetentionBackupsInner object. + */ + public LongTermRetentionBackupsInner longTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** + * The BackupLongTermRetentionPoliciesInner object to access its operations. + */ + private BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies; + + /** + * Gets the BackupLongTermRetentionPoliciesInner object to access its operations. + * @return the BackupLongTermRetentionPoliciesInner object. + */ + public BackupLongTermRetentionPoliciesInner backupLongTermRetentionPolicies() { + return this.backupLongTermRetentionPolicies; + } + + /** + * The ManagedDatabasesInner object to access its operations. + */ + private ManagedDatabasesInner managedDatabases; + + /** + * Gets the ManagedDatabasesInner object to access its operations. + * @return the ManagedDatabasesInner object. + */ + public ManagedDatabasesInner managedDatabases() { + return this.managedDatabases; + } + + /** + * The ServerAutomaticTuningsInner object to access its operations. + */ + private ServerAutomaticTuningsInner serverAutomaticTunings; + + /** + * Gets the ServerAutomaticTuningsInner object to access its operations. + * @return the ServerAutomaticTuningsInner object. + */ + public ServerAutomaticTuningsInner serverAutomaticTunings() { + return this.serverAutomaticTunings; + } + + /** + * The ServerDnsAliasesInner object to access its operations. + */ + private ServerDnsAliasesInner serverDnsAliases; + + /** + * Gets the ServerDnsAliasesInner object to access its operations. + * @return the ServerDnsAliasesInner object. + */ + public ServerDnsAliasesInner serverDnsAliases() { + return this.serverDnsAliases; + } + + /** + * The RestorePointsInner object to access its operations. + */ + private RestorePointsInner restorePoints; + + /** + * Gets the RestorePointsInner object to access its operations. + * @return the RestorePointsInner object. + */ + public RestorePointsInner restorePoints() { + return this.restorePoints; + } + /** * The DatabaseOperationsInner object to access its operations. */ @@ -945,12 +945,6 @@ protected void initialize() { this.virtualNetworkRules = new VirtualNetworkRulesInner(restClient().retrofit(), this); this.databaseVulnerabilityAssessmentRuleBaselines = new DatabaseVulnerabilityAssessmentRuleBaselinesInner(restClient().retrofit(), this); this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsInner(restClient().retrofit(), this); - this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); - this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); - this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); - this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); - this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); - this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); this.jobAgents = new JobAgentsInner(restClient().retrofit(), this); this.jobCredentials = new JobCredentialsInner(restClient().retrofit(), this); this.jobExecutions = new JobExecutionsInner(restClient().retrofit(), this); @@ -960,6 +954,12 @@ protected void initialize() { this.jobTargetExecutions = new JobTargetExecutionsInner(restClient().retrofit(), this); this.jobTargetGroups = new JobTargetGroupsInner(restClient().retrofit(), this); this.jobVersions = new JobVersionsInner(restClient().retrofit(), this); + this.longTermRetentionBackups = new LongTermRetentionBackupsInner(restClient().retrofit(), this); + this.backupLongTermRetentionPolicies = new BackupLongTermRetentionPoliciesInner(restClient().retrofit(), this); + this.managedDatabases = new ManagedDatabasesInner(restClient().retrofit(), this); + this.serverAutomaticTunings = new ServerAutomaticTuningsInner(restClient().retrofit(), this); + this.serverDnsAliases = new ServerDnsAliasesInner(restClient().retrofit(), this); + this.restorePoints = new RestorePointsInner(restClient().retrofit(), this); this.databaseOperations = new DatabaseOperationsInner(restClient().retrofit(), this); this.elasticPoolOperations = new ElasticPoolOperationsInner(restClient().retrofit(), this); this.capabilities = new CapabilitiesInner(restClient().retrofit(), this);