com.microsoft.azure.management.sql.DatabaseActivationOperationsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-sql Show documentation
Show all versions of azure-mgmt-sql Show documentation
This package contains Microsoft Azure SDK for SQL Management module.
/**
*
* Copyright (c) Microsoft and contributors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
package com.microsoft.azure.management.sql;
import com.microsoft.azure.management.sql.models.Column;
import com.microsoft.azure.management.sql.models.ColumnProperties;
import com.microsoft.azure.management.sql.models.Database;
import com.microsoft.azure.management.sql.models.DatabaseCreateOrUpdateResponse;
import com.microsoft.azure.management.sql.models.DatabaseProperties;
import com.microsoft.azure.management.sql.models.ErrorResponse;
import com.microsoft.azure.management.sql.models.OperationImpact;
import com.microsoft.azure.management.sql.models.RecommendedIndex;
import com.microsoft.azure.management.sql.models.RecommendedIndexProperties;
import com.microsoft.azure.management.sql.models.Schema;
import com.microsoft.azure.management.sql.models.SchemaProperties;
import com.microsoft.azure.management.sql.models.ServiceTierAdvisor;
import com.microsoft.azure.management.sql.models.ServiceTierAdvisorProperties;
import com.microsoft.azure.management.sql.models.SloUsageMetric;
import com.microsoft.azure.management.sql.models.Table;
import com.microsoft.azure.management.sql.models.TableProperties;
import com.microsoft.azure.management.sql.models.UpgradeHint;
import com.microsoft.windowsazure.core.OperationStatus;
import com.microsoft.windowsazure.core.ServiceOperations;
import com.microsoft.windowsazure.core.utils.CollectionStringBuilder;
import com.microsoft.windowsazure.exception.ServiceException;
import com.microsoft.windowsazure.tracing.ClientRequestTrackingHandler;
import com.microsoft.windowsazure.tracing.CloudTracing;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.node.NullNode;
import javax.xml.bind.DatatypeConverter;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
/**
* Represents all the operations for operating pertaining to activation on Azure
* SQL Data Warehouse databases. Contains operations to: Pause and Resume
* databases
*/
public class DatabaseActivationOperationsImpl implements ServiceOperations, DatabaseActivationOperations {
/**
* Initializes a new instance of the DatabaseActivationOperationsImpl class.
*
* @param client Reference to the service client.
*/
DatabaseActivationOperationsImpl(SqlManagementClientImpl client) {
this.client = client;
}
private SqlManagementClientImpl client;
/**
* Gets a reference to the
* microsoft.azure.management.sql.SqlManagementClientImpl.
* @return The Client value.
*/
public SqlManagementClientImpl getClient() {
return this.client;
}
/**
* Start an Azure SQL Data Warehouse database pause operation.To determine
* the status of the operation call GetDatabaseActivationOperationStatus.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to pause.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public Future beginPauseAsync(final String resourceGroupName, final String serverName, final String databaseName) {
return this.getClient().getExecutorService().submit(new Callable() {
@Override
public DatabaseCreateOrUpdateResponse call() throws Exception {
return beginPause(resourceGroupName, serverName, databaseName);
}
});
}
/**
* Start an Azure SQL Data Warehouse database pause operation.To determine
* the status of the operation call GetDatabaseActivationOperationStatus.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to pause.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public DatabaseCreateOrUpdateResponse beginPause(String resourceGroupName, String serverName, String databaseName) throws IOException, ServiceException {
// Validate
if (resourceGroupName == null) {
throw new NullPointerException("resourceGroupName");
}
if (serverName == null) {
throw new NullPointerException("serverName");
}
if (databaseName == null) {
throw new NullPointerException("databaseName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap tracingParameters = new HashMap();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("serverName", serverName);
tracingParameters.put("databaseName", databaseName);
CloudTracing.enter(invocationId, this, "beginPauseAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/subscriptions/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/resourceGroups/";
url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
url = url + "/providers/";
url = url + "Microsoft.Sql";
url = url + "/servers/";
url = url + URLEncoder.encode(serverName, "UTF-8");
url = url + "/databases/";
url = url + URLEncoder.encode(databaseName, "UTF-8");
url = url + "/pause";
ArrayList queryParameters = new ArrayList();
queryParameters.add("api-version=" + "2014-04-01");
if (queryParameters.size() > 0) {
url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
}
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpPost httpRequest = new HttpPost(url);
// Set Headers
httpRequest.setHeader("Content-Type", "application/json; charset=utf-8");
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_ACCEPTED) {
ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
DatabaseCreateOrUpdateResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_ACCEPTED) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new DatabaseCreateOrUpdateResponse();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode responseDoc = null;
String responseDocContent = IOUtils.toString(responseContent);
if (responseDocContent == null == false && responseDocContent.length() > 0) {
responseDoc = objectMapper.readTree(responseDocContent);
}
if (responseDoc != null && responseDoc instanceof NullNode == false) {
ErrorResponse errorInstance = new ErrorResponse();
result.setError(errorInstance);
JsonNode codeValue = responseDoc.get("code");
if (codeValue != null && codeValue instanceof NullNode == false) {
String codeInstance;
codeInstance = codeValue.getTextValue();
errorInstance.setCode(codeInstance);
}
JsonNode messageValue = responseDoc.get("message");
if (messageValue != null && messageValue instanceof NullNode == false) {
String messageInstance;
messageInstance = messageValue.getTextValue();
errorInstance.setMessage(messageInstance);
}
JsonNode targetValue = responseDoc.get("target");
if (targetValue != null && targetValue instanceof NullNode == false) {
String targetInstance;
targetInstance = targetValue.getTextValue();
errorInstance.setTarget(targetInstance);
}
Database databaseInstance = new Database();
result.setDatabase(databaseInstance);
JsonNode propertiesValue = responseDoc.get("properties");
if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
DatabaseProperties propertiesInstance = new DatabaseProperties();
databaseInstance.setProperties(propertiesInstance);
JsonNode collationValue = propertiesValue.get("collation");
if (collationValue != null && collationValue instanceof NullNode == false) {
String collationInstance;
collationInstance = collationValue.getTextValue();
propertiesInstance.setCollation(collationInstance);
}
JsonNode creationDateValue = propertiesValue.get("creationDate");
if (creationDateValue != null && creationDateValue instanceof NullNode == false) {
Calendar creationDateInstance;
creationDateInstance = DatatypeConverter.parseDateTime(creationDateValue.getTextValue());
propertiesInstance.setCreationDate(creationDateInstance);
}
JsonNode currentServiceObjectiveIdValue = propertiesValue.get("currentServiceObjectiveId");
if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) {
String currentServiceObjectiveIdInstance;
currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue.getTextValue();
propertiesInstance.setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance);
}
JsonNode databaseIdValue = propertiesValue.get("databaseId");
if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) {
String databaseIdInstance;
databaseIdInstance = databaseIdValue.getTextValue();
propertiesInstance.setDatabaseId(databaseIdInstance);
}
JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate");
if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) {
Calendar earliestRestoreDateInstance;
earliestRestoreDateInstance = DatatypeConverter.parseDateTime(earliestRestoreDateValue.getTextValue());
propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance);
}
JsonNode editionValue = propertiesValue.get("edition");
if (editionValue != null && editionValue instanceof NullNode == false) {
String editionInstance;
editionInstance = editionValue.getTextValue();
propertiesInstance.setEdition(editionInstance);
}
JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes");
if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) {
long maxSizeBytesInstance;
maxSizeBytesInstance = maxSizeBytesValue.getLongValue();
propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance);
}
JsonNode requestedServiceObjectiveIdValue = propertiesValue.get("requestedServiceObjectiveId");
if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) {
String requestedServiceObjectiveIdInstance;
requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance);
}
JsonNode requestedServiceObjectiveNameValue = propertiesValue.get("requestedServiceObjectiveName");
if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) {
String requestedServiceObjectiveNameInstance;
requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveName(requestedServiceObjectiveNameInstance);
}
JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) {
String serviceLevelObjectiveInstance;
serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue();
propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance);
}
JsonNode statusValue = propertiesValue.get("status");
if (statusValue != null && statusValue instanceof NullNode == false) {
String statusInstance;
statusInstance = statusValue.getTextValue();
propertiesInstance.setStatus(statusInstance);
}
JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName");
if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) {
String elasticPoolNameInstance;
elasticPoolNameInstance = elasticPoolNameValue.getTextValue();
propertiesInstance.setElasticPoolName(elasticPoolNameInstance);
}
JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors");
if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) {
for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) {
ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor();
propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance);
JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties");
if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) {
ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties();
serviceTierAdvisorInstance.setProperties(propertiesInstance2);
JsonNode observationPeriodStartValue = propertiesValue2.get("observationPeriodStart");
if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) {
Calendar observationPeriodStartInstance;
observationPeriodStartInstance = DatatypeConverter.parseDateTime(observationPeriodStartValue.getTextValue());
propertiesInstance2.setObservationPeriodStart(observationPeriodStartInstance);
}
JsonNode observationPeriodEndValue = propertiesValue2.get("observationPeriodEnd");
if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) {
Calendar observationPeriodEndInstance;
observationPeriodEndInstance = DatatypeConverter.parseDateTime(observationPeriodEndValue.getTextValue());
propertiesInstance2.setObservationPeriodEnd(observationPeriodEndInstance);
}
JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio");
if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) {
double activeTimeRatioInstance;
activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue();
propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance);
}
JsonNode minDtuValue = propertiesValue2.get("minDtu");
if (minDtuValue != null && minDtuValue instanceof NullNode == false) {
double minDtuInstance;
minDtuInstance = minDtuValue.getDoubleValue();
propertiesInstance2.setMinDtu(minDtuInstance);
}
JsonNode avgDtuValue = propertiesValue2.get("avgDtu");
if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) {
double avgDtuInstance;
avgDtuInstance = avgDtuValue.getDoubleValue();
propertiesInstance2.setAvgDtu(avgDtuInstance);
}
JsonNode maxDtuValue = propertiesValue2.get("maxDtu");
if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) {
double maxDtuInstance;
maxDtuInstance = maxDtuValue.getDoubleValue();
propertiesInstance2.setMaxDtu(maxDtuInstance);
}
JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB");
if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) {
double maxSizeInGBInstance;
maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue();
propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance);
}
JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2.get("serviceLevelObjectiveUsageMetrics");
if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) {
for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) {
SloUsageMetric sloUsageMetricInstance = new SloUsageMetric();
propertiesInstance2.getServiceLevelObjectiveUsageMetrics().add(sloUsageMetricInstance);
JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue2 != null && serviceLevelObjectiveValue2 instanceof NullNode == false) {
String serviceLevelObjectiveInstance2;
serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2.getTextValue();
sloUsageMetricInstance.setServiceLevelObjective(serviceLevelObjectiveInstance2);
}
JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjectiveId");
if (serviceLevelObjectiveIdValue != null && serviceLevelObjectiveIdValue instanceof NullNode == false) {
String serviceLevelObjectiveIdInstance;
serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue.getTextValue();
sloUsageMetricInstance.setServiceLevelObjectiveId(serviceLevelObjectiveIdInstance);
}
JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue.get("inRangeTimeRatio");
if (inRangeTimeRatioValue != null && inRangeTimeRatioValue instanceof NullNode == false) {
double inRangeTimeRatioInstance;
inRangeTimeRatioInstance = inRangeTimeRatioValue.getDoubleValue();
sloUsageMetricInstance.setInRangeTimeRatio(inRangeTimeRatioInstance);
}
JsonNode idValue = serviceLevelObjectiveUsageMetricsValue.get("id");
if (idValue != null && idValue instanceof NullNode == false) {
String idInstance;
idInstance = idValue.getTextValue();
sloUsageMetricInstance.setId(idInstance);
}
JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue.get("name");
if (nameValue != null && nameValue instanceof NullNode == false) {
String nameInstance;
nameInstance = nameValue.getTextValue();
sloUsageMetricInstance.setName(nameInstance);
}
JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue.get("type");
if (typeValue != null && typeValue instanceof NullNode == false) {
String typeInstance;
typeInstance = typeValue.getTextValue();
sloUsageMetricInstance.setType(typeInstance);
}
JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue.get("location");
if (locationValue != null && locationValue instanceof NullNode == false) {
String locationInstance;
locationInstance = locationValue.getTextValue();
sloUsageMetricInstance.setLocation(locationInstance);
}
JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue.get("tags"));
if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) {
Iterator> itr = tagsSequenceElement.getFields();
while (itr.hasNext()) {
Map.Entry property = itr.next();
String tagsKey = property.getKey();
String tagsValue = property.getValue().getTextValue();
sloUsageMetricInstance.getTags().put(tagsKey, tagsValue);
}
}
}
}
JsonNode currentServiceLevelObjectiveValue = propertiesValue2.get("currentServiceLevelObjective");
if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) {
String currentServiceLevelObjectiveInstance;
currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjective(currentServiceLevelObjectiveInstance);
}
JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2.get("currentServiceLevelObjectiveId");
if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) {
String currentServiceLevelObjectiveIdInstance;
currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjectiveId(currentServiceLevelObjectiveIdInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjective");
if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveInstance;
usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjective(usageBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjectiveId");
if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveIdInstance;
usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjectiveId(usageBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjective");
if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjective(databaseSizeBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjectiveId");
if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjectiveId(databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjective");
if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjective(disasterPlanBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjectiveId");
if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjectiveId(disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2.get("overallRecommendationServiceLevelObjective");
if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveInstance;
overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjective(overallRecommendationServiceLevelObjectiveInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("overallRecommendationServiceLevelObjectiveId");
if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveIdInstance;
overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId(overallRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode confidenceValue = propertiesValue2.get("confidence");
if (confidenceValue != null && confidenceValue instanceof NullNode == false) {
double confidenceInstance;
confidenceInstance = confidenceValue.getDoubleValue();
propertiesInstance2.setConfidence(confidenceInstance);
}
}
JsonNode idValue2 = serviceTierAdvisorsValue.get("id");
if (idValue2 != null && idValue2 instanceof NullNode == false) {
String idInstance2;
idInstance2 = idValue2.getTextValue();
serviceTierAdvisorInstance.setId(idInstance2);
}
JsonNode nameValue2 = serviceTierAdvisorsValue.get("name");
if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
String nameInstance2;
nameInstance2 = nameValue2.getTextValue();
serviceTierAdvisorInstance.setName(nameInstance2);
}
JsonNode typeValue2 = serviceTierAdvisorsValue.get("type");
if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
String typeInstance2;
typeInstance2 = typeValue2.getTextValue();
serviceTierAdvisorInstance.setType(typeInstance2);
}
JsonNode locationValue2 = serviceTierAdvisorsValue.get("location");
if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
String locationInstance2;
locationInstance2 = locationValue2.getTextValue();
serviceTierAdvisorInstance.setLocation(locationInstance2);
}
JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue.get("tags"));
if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) {
Iterator> itr2 = tagsSequenceElement2.getFields();
while (itr2.hasNext()) {
Map.Entry property2 = itr2.next();
String tagsKey2 = property2.getKey();
String tagsValue2 = property2.getValue().getTextValue();
serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2);
}
}
}
}
JsonNode upgradeHintValue = propertiesValue.get("upgradeHint");
if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) {
UpgradeHint upgradeHintInstance = new UpgradeHint();
propertiesInstance.setUpgradeHint(upgradeHintInstance);
JsonNode targetServiceLevelObjectiveValue = upgradeHintValue.get("targetServiceLevelObjective");
if (targetServiceLevelObjectiveValue != null && targetServiceLevelObjectiveValue instanceof NullNode == false) {
String targetServiceLevelObjectiveInstance;
targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjective(targetServiceLevelObjectiveInstance);
}
JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue.get("targetServiceLevelObjectiveId");
if (targetServiceLevelObjectiveIdValue != null && targetServiceLevelObjectiveIdValue instanceof NullNode == false) {
String targetServiceLevelObjectiveIdInstance;
targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjectiveId(targetServiceLevelObjectiveIdInstance);
}
JsonNode idValue3 = upgradeHintValue.get("id");
if (idValue3 != null && idValue3 instanceof NullNode == false) {
String idInstance3;
idInstance3 = idValue3.getTextValue();
upgradeHintInstance.setId(idInstance3);
}
JsonNode nameValue3 = upgradeHintValue.get("name");
if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
String nameInstance3;
nameInstance3 = nameValue3.getTextValue();
upgradeHintInstance.setName(nameInstance3);
}
JsonNode typeValue3 = upgradeHintValue.get("type");
if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
String typeInstance3;
typeInstance3 = typeValue3.getTextValue();
upgradeHintInstance.setType(typeInstance3);
}
JsonNode locationValue3 = upgradeHintValue.get("location");
if (locationValue3 != null && locationValue3 instanceof NullNode == false) {
String locationInstance3;
locationInstance3 = locationValue3.getTextValue();
upgradeHintInstance.setLocation(locationInstance3);
}
JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags"));
if (tagsSequenceElement3 != null && tagsSequenceElement3 instanceof NullNode == false) {
Iterator> itr3 = tagsSequenceElement3.getFields();
while (itr3.hasNext()) {
Map.Entry property3 = itr3.next();
String tagsKey3 = property3.getKey();
String tagsValue3 = property3.getValue().getTextValue();
upgradeHintInstance.getTags().put(tagsKey3, tagsValue3);
}
}
}
JsonNode schemasArray = propertiesValue.get("schemas");
if (schemasArray != null && schemasArray instanceof NullNode == false) {
for (JsonNode schemasValue : ((ArrayNode) schemasArray)) {
Schema schemaInstance = new Schema();
propertiesInstance.getSchemas().add(schemaInstance);
JsonNode propertiesValue3 = schemasValue.get("properties");
if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) {
SchemaProperties propertiesInstance3 = new SchemaProperties();
schemaInstance.setProperties(propertiesInstance3);
JsonNode tablesArray = propertiesValue3.get("tables");
if (tablesArray != null && tablesArray instanceof NullNode == false) {
for (JsonNode tablesValue : ((ArrayNode) tablesArray)) {
Table tableInstance = new Table();
propertiesInstance3.getTables().add(tableInstance);
JsonNode propertiesValue4 = tablesValue.get("properties");
if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) {
TableProperties propertiesInstance4 = new TableProperties();
tableInstance.setProperties(propertiesInstance4);
JsonNode tableTypeValue = propertiesValue4.get("tableType");
if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) {
String tableTypeInstance;
tableTypeInstance = tableTypeValue.getTextValue();
propertiesInstance4.setTableType(tableTypeInstance);
}
JsonNode columnsArray = propertiesValue4.get("columns");
if (columnsArray != null && columnsArray instanceof NullNode == false) {
for (JsonNode columnsValue : ((ArrayNode) columnsArray)) {
Column columnInstance = new Column();
propertiesInstance4.getColumns().add(columnInstance);
JsonNode propertiesValue5 = columnsValue.get("properties");
if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) {
ColumnProperties propertiesInstance5 = new ColumnProperties();
columnInstance.setProperties(propertiesInstance5);
JsonNode columnTypeValue = propertiesValue5.get("columnType");
if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) {
String columnTypeInstance;
columnTypeInstance = columnTypeValue.getTextValue();
propertiesInstance5.setColumnType(columnTypeInstance);
}
}
JsonNode idValue4 = columnsValue.get("id");
if (idValue4 != null && idValue4 instanceof NullNode == false) {
String idInstance4;
idInstance4 = idValue4.getTextValue();
columnInstance.setId(idInstance4);
}
JsonNode nameValue4 = columnsValue.get("name");
if (nameValue4 != null && nameValue4 instanceof NullNode == false) {
String nameInstance4;
nameInstance4 = nameValue4.getTextValue();
columnInstance.setName(nameInstance4);
}
JsonNode typeValue4 = columnsValue.get("type");
if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
String typeInstance4;
typeInstance4 = typeValue4.getTextValue();
columnInstance.setType(typeInstance4);
}
JsonNode locationValue4 = columnsValue.get("location");
if (locationValue4 != null && locationValue4 instanceof NullNode == false) {
String locationInstance4;
locationInstance4 = locationValue4.getTextValue();
columnInstance.setLocation(locationInstance4);
}
JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue.get("tags"));
if (tagsSequenceElement4 != null && tagsSequenceElement4 instanceof NullNode == false) {
Iterator> itr4 = tagsSequenceElement4.getFields();
while (itr4.hasNext()) {
Map.Entry property4 = itr4.next();
String tagsKey4 = property4.getKey();
String tagsValue4 = property4.getValue().getTextValue();
columnInstance.getTags().put(tagsKey4, tagsValue4);
}
}
}
}
JsonNode recommendedIndexesArray = propertiesValue4.get("recommendedIndexes");
if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) {
for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) {
RecommendedIndex recommendedIndexInstance = new RecommendedIndex();
propertiesInstance4.getRecommendedIndexes().add(recommendedIndexInstance);
JsonNode propertiesValue6 = recommendedIndexesValue.get("properties");
if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) {
RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties();
recommendedIndexInstance.setProperties(propertiesInstance6);
JsonNode actionValue = propertiesValue6.get("action");
if (actionValue != null && actionValue instanceof NullNode == false) {
String actionInstance;
actionInstance = actionValue.getTextValue();
propertiesInstance6.setAction(actionInstance);
}
JsonNode stateValue = propertiesValue6.get("state");
if (stateValue != null && stateValue instanceof NullNode == false) {
String stateInstance;
stateInstance = stateValue.getTextValue();
propertiesInstance6.setState(stateInstance);
}
JsonNode createdValue = propertiesValue6.get("created");
if (createdValue != null && createdValue instanceof NullNode == false) {
Calendar createdInstance;
createdInstance = DatatypeConverter.parseDateTime(createdValue.getTextValue());
propertiesInstance6.setCreated(createdInstance);
}
JsonNode lastModifiedValue = propertiesValue6.get("lastModified");
if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) {
Calendar lastModifiedInstance;
lastModifiedInstance = DatatypeConverter.parseDateTime(lastModifiedValue.getTextValue());
propertiesInstance6.setLastModified(lastModifiedInstance);
}
JsonNode indexTypeValue = propertiesValue6.get("indexType");
if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) {
String indexTypeInstance;
indexTypeInstance = indexTypeValue.getTextValue();
propertiesInstance6.setIndexType(indexTypeInstance);
}
JsonNode schemaValue = propertiesValue6.get("schema");
if (schemaValue != null && schemaValue instanceof NullNode == false) {
String schemaInstance2;
schemaInstance2 = schemaValue.getTextValue();
propertiesInstance6.setSchema(schemaInstance2);
}
JsonNode tableValue = propertiesValue6.get("table");
if (tableValue != null && tableValue instanceof NullNode == false) {
String tableInstance2;
tableInstance2 = tableValue.getTextValue();
propertiesInstance6.setTable(tableInstance2);
}
JsonNode columnsArray2 = propertiesValue6.get("columns");
if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) {
for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) {
propertiesInstance6.getColumns().add(columnsValue2.getTextValue());
}
}
JsonNode includedColumnsArray = propertiesValue6.get("includedColumns");
if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) {
for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) {
propertiesInstance6.getIncludedColumns().add(includedColumnsValue.getTextValue());
}
}
JsonNode indexScriptValue = propertiesValue6.get("indexScript");
if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) {
String indexScriptInstance;
indexScriptInstance = indexScriptValue.getTextValue();
propertiesInstance6.setIndexScript(indexScriptInstance);
}
JsonNode estimatedImpactArray = propertiesValue6.get("estimatedImpact");
if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) {
for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) {
OperationImpact operationImpactInstance = new OperationImpact();
propertiesInstance6.getEstimatedImpact().add(operationImpactInstance);
JsonNode nameValue5 = estimatedImpactValue.get("name");
if (nameValue5 != null && nameValue5 instanceof NullNode == false) {
String nameInstance5;
nameInstance5 = nameValue5.getTextValue();
operationImpactInstance.setName(nameInstance5);
}
JsonNode unitValue = estimatedImpactValue.get("unit");
if (unitValue != null && unitValue instanceof NullNode == false) {
String unitInstance;
unitInstance = unitValue.getTextValue();
operationImpactInstance.setUnit(unitInstance);
}
JsonNode changeValueAbsoluteValue = estimatedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue != null && changeValueAbsoluteValue instanceof NullNode == false) {
double changeValueAbsoluteInstance;
changeValueAbsoluteInstance = changeValueAbsoluteValue.getDoubleValue();
operationImpactInstance.setChangeValueAbsolute(changeValueAbsoluteInstance);
}
JsonNode changeValueRelativeValue = estimatedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue != null && changeValueRelativeValue instanceof NullNode == false) {
double changeValueRelativeInstance;
changeValueRelativeInstance = changeValueRelativeValue.getDoubleValue();
operationImpactInstance.setChangeValueRelative(changeValueRelativeInstance);
}
}
}
JsonNode reportedImpactArray = propertiesValue6.get("reportedImpact");
if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) {
for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) {
OperationImpact operationImpactInstance2 = new OperationImpact();
propertiesInstance6.getReportedImpact().add(operationImpactInstance2);
JsonNode nameValue6 = reportedImpactValue.get("name");
if (nameValue6 != null && nameValue6 instanceof NullNode == false) {
String nameInstance6;
nameInstance6 = nameValue6.getTextValue();
operationImpactInstance2.setName(nameInstance6);
}
JsonNode unitValue2 = reportedImpactValue.get("unit");
if (unitValue2 != null && unitValue2 instanceof NullNode == false) {
String unitInstance2;
unitInstance2 = unitValue2.getTextValue();
operationImpactInstance2.setUnit(unitInstance2);
}
JsonNode changeValueAbsoluteValue2 = reportedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue2 != null && changeValueAbsoluteValue2 instanceof NullNode == false) {
double changeValueAbsoluteInstance2;
changeValueAbsoluteInstance2 = changeValueAbsoluteValue2.getDoubleValue();
operationImpactInstance2.setChangeValueAbsolute(changeValueAbsoluteInstance2);
}
JsonNode changeValueRelativeValue2 = reportedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue2 != null && changeValueRelativeValue2 instanceof NullNode == false) {
double changeValueRelativeInstance2;
changeValueRelativeInstance2 = changeValueRelativeValue2.getDoubleValue();
operationImpactInstance2.setChangeValueRelative(changeValueRelativeInstance2);
}
}
}
}
JsonNode idValue5 = recommendedIndexesValue.get("id");
if (idValue5 != null && idValue5 instanceof NullNode == false) {
String idInstance5;
idInstance5 = idValue5.getTextValue();
recommendedIndexInstance.setId(idInstance5);
}
JsonNode nameValue7 = recommendedIndexesValue.get("name");
if (nameValue7 != null && nameValue7 instanceof NullNode == false) {
String nameInstance7;
nameInstance7 = nameValue7.getTextValue();
recommendedIndexInstance.setName(nameInstance7);
}
JsonNode typeValue5 = recommendedIndexesValue.get("type");
if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
String typeInstance5;
typeInstance5 = typeValue5.getTextValue();
recommendedIndexInstance.setType(typeInstance5);
}
JsonNode locationValue5 = recommendedIndexesValue.get("location");
if (locationValue5 != null && locationValue5 instanceof NullNode == false) {
String locationInstance5;
locationInstance5 = locationValue5.getTextValue();
recommendedIndexInstance.setLocation(locationInstance5);
}
JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue.get("tags"));
if (tagsSequenceElement5 != null && tagsSequenceElement5 instanceof NullNode == false) {
Iterator> itr5 = tagsSequenceElement5.getFields();
while (itr5.hasNext()) {
Map.Entry property5 = itr5.next();
String tagsKey5 = property5.getKey();
String tagsValue5 = property5.getValue().getTextValue();
recommendedIndexInstance.getTags().put(tagsKey5, tagsValue5);
}
}
}
}
}
JsonNode idValue6 = tablesValue.get("id");
if (idValue6 != null && idValue6 instanceof NullNode == false) {
String idInstance6;
idInstance6 = idValue6.getTextValue();
tableInstance.setId(idInstance6);
}
JsonNode nameValue8 = tablesValue.get("name");
if (nameValue8 != null && nameValue8 instanceof NullNode == false) {
String nameInstance8;
nameInstance8 = nameValue8.getTextValue();
tableInstance.setName(nameInstance8);
}
JsonNode typeValue6 = tablesValue.get("type");
if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
String typeInstance6;
typeInstance6 = typeValue6.getTextValue();
tableInstance.setType(typeInstance6);
}
JsonNode locationValue6 = tablesValue.get("location");
if (locationValue6 != null && locationValue6 instanceof NullNode == false) {
String locationInstance6;
locationInstance6 = locationValue6.getTextValue();
tableInstance.setLocation(locationInstance6);
}
JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue.get("tags"));
if (tagsSequenceElement6 != null && tagsSequenceElement6 instanceof NullNode == false) {
Iterator> itr6 = tagsSequenceElement6.getFields();
while (itr6.hasNext()) {
Map.Entry property6 = itr6.next();
String tagsKey6 = property6.getKey();
String tagsValue6 = property6.getValue().getTextValue();
tableInstance.getTags().put(tagsKey6, tagsValue6);
}
}
}
}
}
JsonNode idValue7 = schemasValue.get("id");
if (idValue7 != null && idValue7 instanceof NullNode == false) {
String idInstance7;
idInstance7 = idValue7.getTextValue();
schemaInstance.setId(idInstance7);
}
JsonNode nameValue9 = schemasValue.get("name");
if (nameValue9 != null && nameValue9 instanceof NullNode == false) {
String nameInstance9;
nameInstance9 = nameValue9.getTextValue();
schemaInstance.setName(nameInstance9);
}
JsonNode typeValue7 = schemasValue.get("type");
if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
String typeInstance7;
typeInstance7 = typeValue7.getTextValue();
schemaInstance.setType(typeInstance7);
}
JsonNode locationValue7 = schemasValue.get("location");
if (locationValue7 != null && locationValue7 instanceof NullNode == false) {
String locationInstance7;
locationInstance7 = locationValue7.getTextValue();
schemaInstance.setLocation(locationInstance7);
}
JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags"));
if (tagsSequenceElement7 != null && tagsSequenceElement7 instanceof NullNode == false) {
Iterator> itr7 = tagsSequenceElement7.getFields();
while (itr7.hasNext()) {
Map.Entry property7 = itr7.next();
String tagsKey7 = property7.getKey();
String tagsValue7 = property7.getValue().getTextValue();
schemaInstance.getTags().put(tagsKey7, tagsValue7);
}
}
}
}
JsonNode defaultSecondaryLocationValue = propertiesValue.get("defaultSecondaryLocation");
if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) {
String defaultSecondaryLocationInstance;
defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue();
propertiesInstance.setDefaultSecondaryLocation(defaultSecondaryLocationInstance);
}
}
JsonNode idValue8 = responseDoc.get("id");
if (idValue8 != null && idValue8 instanceof NullNode == false) {
String idInstance8;
idInstance8 = idValue8.getTextValue();
databaseInstance.setId(idInstance8);
}
JsonNode nameValue10 = responseDoc.get("name");
if (nameValue10 != null && nameValue10 instanceof NullNode == false) {
String nameInstance10;
nameInstance10 = nameValue10.getTextValue();
databaseInstance.setName(nameInstance10);
}
JsonNode typeValue8 = responseDoc.get("type");
if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
String typeInstance8;
typeInstance8 = typeValue8.getTextValue();
databaseInstance.setType(typeInstance8);
}
JsonNode locationValue8 = responseDoc.get("location");
if (locationValue8 != null && locationValue8 instanceof NullNode == false) {
String locationInstance8;
locationInstance8 = locationValue8.getTextValue();
databaseInstance.setLocation(locationInstance8);
}
JsonNode tagsSequenceElement8 = ((JsonNode) responseDoc.get("tags"));
if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) {
Iterator> itr8 = tagsSequenceElement8.getFields();
while (itr8.hasNext()) {
Map.Entry property8 = itr8.next();
String tagsKey8 = property8.getKey();
String tagsValue8 = property8.getValue().getTextValue();
databaseInstance.getTags().put(tagsKey8, tagsValue8);
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("Location").length > 0) {
result.setOperationStatusLink(httpResponse.getFirstHeader("Location").getValue());
}
if (httpResponse.getHeaders("Retry-After").length > 0) {
result.setRetryAfter(DatatypeConverter.parseInt(httpResponse.getFirstHeader("Retry-After").getValue()));
}
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (statusCode == HttpStatus.SC_OK) {
result.setStatus(OperationStatus.Succeeded);
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
/**
* Start an Azure SQL Data Warehouse database resume operation. To determine
* the status of the operation call GetDatabaseActivationOperationStatus.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to resume.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public Future beginResumeAsync(final String resourceGroupName, final String serverName, final String databaseName) {
return this.getClient().getExecutorService().submit(new Callable() {
@Override
public DatabaseCreateOrUpdateResponse call() throws Exception {
return beginResume(resourceGroupName, serverName, databaseName);
}
});
}
/**
* Start an Azure SQL Data Warehouse database resume operation. To determine
* the status of the operation call GetDatabaseActivationOperationStatus.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to resume.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public DatabaseCreateOrUpdateResponse beginResume(String resourceGroupName, String serverName, String databaseName) throws IOException, ServiceException {
// Validate
if (resourceGroupName == null) {
throw new NullPointerException("resourceGroupName");
}
if (serverName == null) {
throw new NullPointerException("serverName");
}
if (databaseName == null) {
throw new NullPointerException("databaseName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap tracingParameters = new HashMap();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("serverName", serverName);
tracingParameters.put("databaseName", databaseName);
CloudTracing.enter(invocationId, this, "beginResumeAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/subscriptions/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/resourceGroups/";
url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
url = url + "/providers/";
url = url + "Microsoft.Sql";
url = url + "/servers/";
url = url + URLEncoder.encode(serverName, "UTF-8");
url = url + "/databases/";
url = url + URLEncoder.encode(databaseName, "UTF-8");
url = url + "/resume";
ArrayList queryParameters = new ArrayList();
queryParameters.add("api-version=" + "2014-04-01");
if (queryParameters.size() > 0) {
url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
}
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpPost httpRequest = new HttpPost(url);
// Set Headers
httpRequest.setHeader("Content-Type", "application/json; charset=utf-8");
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_ACCEPTED) {
ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
DatabaseCreateOrUpdateResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_ACCEPTED) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new DatabaseCreateOrUpdateResponse();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode responseDoc = null;
String responseDocContent = IOUtils.toString(responseContent);
if (responseDocContent == null == false && responseDocContent.length() > 0) {
responseDoc = objectMapper.readTree(responseDocContent);
}
if (responseDoc != null && responseDoc instanceof NullNode == false) {
ErrorResponse errorInstance = new ErrorResponse();
result.setError(errorInstance);
JsonNode codeValue = responseDoc.get("code");
if (codeValue != null && codeValue instanceof NullNode == false) {
String codeInstance;
codeInstance = codeValue.getTextValue();
errorInstance.setCode(codeInstance);
}
JsonNode messageValue = responseDoc.get("message");
if (messageValue != null && messageValue instanceof NullNode == false) {
String messageInstance;
messageInstance = messageValue.getTextValue();
errorInstance.setMessage(messageInstance);
}
JsonNode targetValue = responseDoc.get("target");
if (targetValue != null && targetValue instanceof NullNode == false) {
String targetInstance;
targetInstance = targetValue.getTextValue();
errorInstance.setTarget(targetInstance);
}
Database databaseInstance = new Database();
result.setDatabase(databaseInstance);
JsonNode propertiesValue = responseDoc.get("properties");
if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
DatabaseProperties propertiesInstance = new DatabaseProperties();
databaseInstance.setProperties(propertiesInstance);
JsonNode collationValue = propertiesValue.get("collation");
if (collationValue != null && collationValue instanceof NullNode == false) {
String collationInstance;
collationInstance = collationValue.getTextValue();
propertiesInstance.setCollation(collationInstance);
}
JsonNode creationDateValue = propertiesValue.get("creationDate");
if (creationDateValue != null && creationDateValue instanceof NullNode == false) {
Calendar creationDateInstance;
creationDateInstance = DatatypeConverter.parseDateTime(creationDateValue.getTextValue());
propertiesInstance.setCreationDate(creationDateInstance);
}
JsonNode currentServiceObjectiveIdValue = propertiesValue.get("currentServiceObjectiveId");
if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) {
String currentServiceObjectiveIdInstance;
currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue.getTextValue();
propertiesInstance.setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance);
}
JsonNode databaseIdValue = propertiesValue.get("databaseId");
if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) {
String databaseIdInstance;
databaseIdInstance = databaseIdValue.getTextValue();
propertiesInstance.setDatabaseId(databaseIdInstance);
}
JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate");
if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) {
Calendar earliestRestoreDateInstance;
earliestRestoreDateInstance = DatatypeConverter.parseDateTime(earliestRestoreDateValue.getTextValue());
propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance);
}
JsonNode editionValue = propertiesValue.get("edition");
if (editionValue != null && editionValue instanceof NullNode == false) {
String editionInstance;
editionInstance = editionValue.getTextValue();
propertiesInstance.setEdition(editionInstance);
}
JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes");
if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) {
long maxSizeBytesInstance;
maxSizeBytesInstance = maxSizeBytesValue.getLongValue();
propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance);
}
JsonNode requestedServiceObjectiveIdValue = propertiesValue.get("requestedServiceObjectiveId");
if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) {
String requestedServiceObjectiveIdInstance;
requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance);
}
JsonNode requestedServiceObjectiveNameValue = propertiesValue.get("requestedServiceObjectiveName");
if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) {
String requestedServiceObjectiveNameInstance;
requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveName(requestedServiceObjectiveNameInstance);
}
JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) {
String serviceLevelObjectiveInstance;
serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue();
propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance);
}
JsonNode statusValue = propertiesValue.get("status");
if (statusValue != null && statusValue instanceof NullNode == false) {
String statusInstance;
statusInstance = statusValue.getTextValue();
propertiesInstance.setStatus(statusInstance);
}
JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName");
if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) {
String elasticPoolNameInstance;
elasticPoolNameInstance = elasticPoolNameValue.getTextValue();
propertiesInstance.setElasticPoolName(elasticPoolNameInstance);
}
JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors");
if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) {
for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) {
ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor();
propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance);
JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties");
if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) {
ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties();
serviceTierAdvisorInstance.setProperties(propertiesInstance2);
JsonNode observationPeriodStartValue = propertiesValue2.get("observationPeriodStart");
if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) {
Calendar observationPeriodStartInstance;
observationPeriodStartInstance = DatatypeConverter.parseDateTime(observationPeriodStartValue.getTextValue());
propertiesInstance2.setObservationPeriodStart(observationPeriodStartInstance);
}
JsonNode observationPeriodEndValue = propertiesValue2.get("observationPeriodEnd");
if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) {
Calendar observationPeriodEndInstance;
observationPeriodEndInstance = DatatypeConverter.parseDateTime(observationPeriodEndValue.getTextValue());
propertiesInstance2.setObservationPeriodEnd(observationPeriodEndInstance);
}
JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio");
if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) {
double activeTimeRatioInstance;
activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue();
propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance);
}
JsonNode minDtuValue = propertiesValue2.get("minDtu");
if (minDtuValue != null && minDtuValue instanceof NullNode == false) {
double minDtuInstance;
minDtuInstance = minDtuValue.getDoubleValue();
propertiesInstance2.setMinDtu(minDtuInstance);
}
JsonNode avgDtuValue = propertiesValue2.get("avgDtu");
if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) {
double avgDtuInstance;
avgDtuInstance = avgDtuValue.getDoubleValue();
propertiesInstance2.setAvgDtu(avgDtuInstance);
}
JsonNode maxDtuValue = propertiesValue2.get("maxDtu");
if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) {
double maxDtuInstance;
maxDtuInstance = maxDtuValue.getDoubleValue();
propertiesInstance2.setMaxDtu(maxDtuInstance);
}
JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB");
if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) {
double maxSizeInGBInstance;
maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue();
propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance);
}
JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2.get("serviceLevelObjectiveUsageMetrics");
if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) {
for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) {
SloUsageMetric sloUsageMetricInstance = new SloUsageMetric();
propertiesInstance2.getServiceLevelObjectiveUsageMetrics().add(sloUsageMetricInstance);
JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue2 != null && serviceLevelObjectiveValue2 instanceof NullNode == false) {
String serviceLevelObjectiveInstance2;
serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2.getTextValue();
sloUsageMetricInstance.setServiceLevelObjective(serviceLevelObjectiveInstance2);
}
JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjectiveId");
if (serviceLevelObjectiveIdValue != null && serviceLevelObjectiveIdValue instanceof NullNode == false) {
String serviceLevelObjectiveIdInstance;
serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue.getTextValue();
sloUsageMetricInstance.setServiceLevelObjectiveId(serviceLevelObjectiveIdInstance);
}
JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue.get("inRangeTimeRatio");
if (inRangeTimeRatioValue != null && inRangeTimeRatioValue instanceof NullNode == false) {
double inRangeTimeRatioInstance;
inRangeTimeRatioInstance = inRangeTimeRatioValue.getDoubleValue();
sloUsageMetricInstance.setInRangeTimeRatio(inRangeTimeRatioInstance);
}
JsonNode idValue = serviceLevelObjectiveUsageMetricsValue.get("id");
if (idValue != null && idValue instanceof NullNode == false) {
String idInstance;
idInstance = idValue.getTextValue();
sloUsageMetricInstance.setId(idInstance);
}
JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue.get("name");
if (nameValue != null && nameValue instanceof NullNode == false) {
String nameInstance;
nameInstance = nameValue.getTextValue();
sloUsageMetricInstance.setName(nameInstance);
}
JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue.get("type");
if (typeValue != null && typeValue instanceof NullNode == false) {
String typeInstance;
typeInstance = typeValue.getTextValue();
sloUsageMetricInstance.setType(typeInstance);
}
JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue.get("location");
if (locationValue != null && locationValue instanceof NullNode == false) {
String locationInstance;
locationInstance = locationValue.getTextValue();
sloUsageMetricInstance.setLocation(locationInstance);
}
JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue.get("tags"));
if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) {
Iterator> itr = tagsSequenceElement.getFields();
while (itr.hasNext()) {
Map.Entry property = itr.next();
String tagsKey = property.getKey();
String tagsValue = property.getValue().getTextValue();
sloUsageMetricInstance.getTags().put(tagsKey, tagsValue);
}
}
}
}
JsonNode currentServiceLevelObjectiveValue = propertiesValue2.get("currentServiceLevelObjective");
if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) {
String currentServiceLevelObjectiveInstance;
currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjective(currentServiceLevelObjectiveInstance);
}
JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2.get("currentServiceLevelObjectiveId");
if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) {
String currentServiceLevelObjectiveIdInstance;
currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjectiveId(currentServiceLevelObjectiveIdInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjective");
if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveInstance;
usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjective(usageBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjectiveId");
if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveIdInstance;
usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjectiveId(usageBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjective");
if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjective(databaseSizeBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjectiveId");
if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjectiveId(databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjective");
if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjective(disasterPlanBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjectiveId");
if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjectiveId(disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2.get("overallRecommendationServiceLevelObjective");
if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveInstance;
overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjective(overallRecommendationServiceLevelObjectiveInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("overallRecommendationServiceLevelObjectiveId");
if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveIdInstance;
overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId(overallRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode confidenceValue = propertiesValue2.get("confidence");
if (confidenceValue != null && confidenceValue instanceof NullNode == false) {
double confidenceInstance;
confidenceInstance = confidenceValue.getDoubleValue();
propertiesInstance2.setConfidence(confidenceInstance);
}
}
JsonNode idValue2 = serviceTierAdvisorsValue.get("id");
if (idValue2 != null && idValue2 instanceof NullNode == false) {
String idInstance2;
idInstance2 = idValue2.getTextValue();
serviceTierAdvisorInstance.setId(idInstance2);
}
JsonNode nameValue2 = serviceTierAdvisorsValue.get("name");
if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
String nameInstance2;
nameInstance2 = nameValue2.getTextValue();
serviceTierAdvisorInstance.setName(nameInstance2);
}
JsonNode typeValue2 = serviceTierAdvisorsValue.get("type");
if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
String typeInstance2;
typeInstance2 = typeValue2.getTextValue();
serviceTierAdvisorInstance.setType(typeInstance2);
}
JsonNode locationValue2 = serviceTierAdvisorsValue.get("location");
if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
String locationInstance2;
locationInstance2 = locationValue2.getTextValue();
serviceTierAdvisorInstance.setLocation(locationInstance2);
}
JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue.get("tags"));
if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) {
Iterator> itr2 = tagsSequenceElement2.getFields();
while (itr2.hasNext()) {
Map.Entry property2 = itr2.next();
String tagsKey2 = property2.getKey();
String tagsValue2 = property2.getValue().getTextValue();
serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2);
}
}
}
}
JsonNode upgradeHintValue = propertiesValue.get("upgradeHint");
if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) {
UpgradeHint upgradeHintInstance = new UpgradeHint();
propertiesInstance.setUpgradeHint(upgradeHintInstance);
JsonNode targetServiceLevelObjectiveValue = upgradeHintValue.get("targetServiceLevelObjective");
if (targetServiceLevelObjectiveValue != null && targetServiceLevelObjectiveValue instanceof NullNode == false) {
String targetServiceLevelObjectiveInstance;
targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjective(targetServiceLevelObjectiveInstance);
}
JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue.get("targetServiceLevelObjectiveId");
if (targetServiceLevelObjectiveIdValue != null && targetServiceLevelObjectiveIdValue instanceof NullNode == false) {
String targetServiceLevelObjectiveIdInstance;
targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjectiveId(targetServiceLevelObjectiveIdInstance);
}
JsonNode idValue3 = upgradeHintValue.get("id");
if (idValue3 != null && idValue3 instanceof NullNode == false) {
String idInstance3;
idInstance3 = idValue3.getTextValue();
upgradeHintInstance.setId(idInstance3);
}
JsonNode nameValue3 = upgradeHintValue.get("name");
if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
String nameInstance3;
nameInstance3 = nameValue3.getTextValue();
upgradeHintInstance.setName(nameInstance3);
}
JsonNode typeValue3 = upgradeHintValue.get("type");
if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
String typeInstance3;
typeInstance3 = typeValue3.getTextValue();
upgradeHintInstance.setType(typeInstance3);
}
JsonNode locationValue3 = upgradeHintValue.get("location");
if (locationValue3 != null && locationValue3 instanceof NullNode == false) {
String locationInstance3;
locationInstance3 = locationValue3.getTextValue();
upgradeHintInstance.setLocation(locationInstance3);
}
JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags"));
if (tagsSequenceElement3 != null && tagsSequenceElement3 instanceof NullNode == false) {
Iterator> itr3 = tagsSequenceElement3.getFields();
while (itr3.hasNext()) {
Map.Entry property3 = itr3.next();
String tagsKey3 = property3.getKey();
String tagsValue3 = property3.getValue().getTextValue();
upgradeHintInstance.getTags().put(tagsKey3, tagsValue3);
}
}
}
JsonNode schemasArray = propertiesValue.get("schemas");
if (schemasArray != null && schemasArray instanceof NullNode == false) {
for (JsonNode schemasValue : ((ArrayNode) schemasArray)) {
Schema schemaInstance = new Schema();
propertiesInstance.getSchemas().add(schemaInstance);
JsonNode propertiesValue3 = schemasValue.get("properties");
if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) {
SchemaProperties propertiesInstance3 = new SchemaProperties();
schemaInstance.setProperties(propertiesInstance3);
JsonNode tablesArray = propertiesValue3.get("tables");
if (tablesArray != null && tablesArray instanceof NullNode == false) {
for (JsonNode tablesValue : ((ArrayNode) tablesArray)) {
Table tableInstance = new Table();
propertiesInstance3.getTables().add(tableInstance);
JsonNode propertiesValue4 = tablesValue.get("properties");
if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) {
TableProperties propertiesInstance4 = new TableProperties();
tableInstance.setProperties(propertiesInstance4);
JsonNode tableTypeValue = propertiesValue4.get("tableType");
if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) {
String tableTypeInstance;
tableTypeInstance = tableTypeValue.getTextValue();
propertiesInstance4.setTableType(tableTypeInstance);
}
JsonNode columnsArray = propertiesValue4.get("columns");
if (columnsArray != null && columnsArray instanceof NullNode == false) {
for (JsonNode columnsValue : ((ArrayNode) columnsArray)) {
Column columnInstance = new Column();
propertiesInstance4.getColumns().add(columnInstance);
JsonNode propertiesValue5 = columnsValue.get("properties");
if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) {
ColumnProperties propertiesInstance5 = new ColumnProperties();
columnInstance.setProperties(propertiesInstance5);
JsonNode columnTypeValue = propertiesValue5.get("columnType");
if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) {
String columnTypeInstance;
columnTypeInstance = columnTypeValue.getTextValue();
propertiesInstance5.setColumnType(columnTypeInstance);
}
}
JsonNode idValue4 = columnsValue.get("id");
if (idValue4 != null && idValue4 instanceof NullNode == false) {
String idInstance4;
idInstance4 = idValue4.getTextValue();
columnInstance.setId(idInstance4);
}
JsonNode nameValue4 = columnsValue.get("name");
if (nameValue4 != null && nameValue4 instanceof NullNode == false) {
String nameInstance4;
nameInstance4 = nameValue4.getTextValue();
columnInstance.setName(nameInstance4);
}
JsonNode typeValue4 = columnsValue.get("type");
if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
String typeInstance4;
typeInstance4 = typeValue4.getTextValue();
columnInstance.setType(typeInstance4);
}
JsonNode locationValue4 = columnsValue.get("location");
if (locationValue4 != null && locationValue4 instanceof NullNode == false) {
String locationInstance4;
locationInstance4 = locationValue4.getTextValue();
columnInstance.setLocation(locationInstance4);
}
JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue.get("tags"));
if (tagsSequenceElement4 != null && tagsSequenceElement4 instanceof NullNode == false) {
Iterator> itr4 = tagsSequenceElement4.getFields();
while (itr4.hasNext()) {
Map.Entry property4 = itr4.next();
String tagsKey4 = property4.getKey();
String tagsValue4 = property4.getValue().getTextValue();
columnInstance.getTags().put(tagsKey4, tagsValue4);
}
}
}
}
JsonNode recommendedIndexesArray = propertiesValue4.get("recommendedIndexes");
if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) {
for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) {
RecommendedIndex recommendedIndexInstance = new RecommendedIndex();
propertiesInstance4.getRecommendedIndexes().add(recommendedIndexInstance);
JsonNode propertiesValue6 = recommendedIndexesValue.get("properties");
if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) {
RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties();
recommendedIndexInstance.setProperties(propertiesInstance6);
JsonNode actionValue = propertiesValue6.get("action");
if (actionValue != null && actionValue instanceof NullNode == false) {
String actionInstance;
actionInstance = actionValue.getTextValue();
propertiesInstance6.setAction(actionInstance);
}
JsonNode stateValue = propertiesValue6.get("state");
if (stateValue != null && stateValue instanceof NullNode == false) {
String stateInstance;
stateInstance = stateValue.getTextValue();
propertiesInstance6.setState(stateInstance);
}
JsonNode createdValue = propertiesValue6.get("created");
if (createdValue != null && createdValue instanceof NullNode == false) {
Calendar createdInstance;
createdInstance = DatatypeConverter.parseDateTime(createdValue.getTextValue());
propertiesInstance6.setCreated(createdInstance);
}
JsonNode lastModifiedValue = propertiesValue6.get("lastModified");
if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) {
Calendar lastModifiedInstance;
lastModifiedInstance = DatatypeConverter.parseDateTime(lastModifiedValue.getTextValue());
propertiesInstance6.setLastModified(lastModifiedInstance);
}
JsonNode indexTypeValue = propertiesValue6.get("indexType");
if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) {
String indexTypeInstance;
indexTypeInstance = indexTypeValue.getTextValue();
propertiesInstance6.setIndexType(indexTypeInstance);
}
JsonNode schemaValue = propertiesValue6.get("schema");
if (schemaValue != null && schemaValue instanceof NullNode == false) {
String schemaInstance2;
schemaInstance2 = schemaValue.getTextValue();
propertiesInstance6.setSchema(schemaInstance2);
}
JsonNode tableValue = propertiesValue6.get("table");
if (tableValue != null && tableValue instanceof NullNode == false) {
String tableInstance2;
tableInstance2 = tableValue.getTextValue();
propertiesInstance6.setTable(tableInstance2);
}
JsonNode columnsArray2 = propertiesValue6.get("columns");
if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) {
for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) {
propertiesInstance6.getColumns().add(columnsValue2.getTextValue());
}
}
JsonNode includedColumnsArray = propertiesValue6.get("includedColumns");
if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) {
for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) {
propertiesInstance6.getIncludedColumns().add(includedColumnsValue.getTextValue());
}
}
JsonNode indexScriptValue = propertiesValue6.get("indexScript");
if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) {
String indexScriptInstance;
indexScriptInstance = indexScriptValue.getTextValue();
propertiesInstance6.setIndexScript(indexScriptInstance);
}
JsonNode estimatedImpactArray = propertiesValue6.get("estimatedImpact");
if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) {
for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) {
OperationImpact operationImpactInstance = new OperationImpact();
propertiesInstance6.getEstimatedImpact().add(operationImpactInstance);
JsonNode nameValue5 = estimatedImpactValue.get("name");
if (nameValue5 != null && nameValue5 instanceof NullNode == false) {
String nameInstance5;
nameInstance5 = nameValue5.getTextValue();
operationImpactInstance.setName(nameInstance5);
}
JsonNode unitValue = estimatedImpactValue.get("unit");
if (unitValue != null && unitValue instanceof NullNode == false) {
String unitInstance;
unitInstance = unitValue.getTextValue();
operationImpactInstance.setUnit(unitInstance);
}
JsonNode changeValueAbsoluteValue = estimatedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue != null && changeValueAbsoluteValue instanceof NullNode == false) {
double changeValueAbsoluteInstance;
changeValueAbsoluteInstance = changeValueAbsoluteValue.getDoubleValue();
operationImpactInstance.setChangeValueAbsolute(changeValueAbsoluteInstance);
}
JsonNode changeValueRelativeValue = estimatedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue != null && changeValueRelativeValue instanceof NullNode == false) {
double changeValueRelativeInstance;
changeValueRelativeInstance = changeValueRelativeValue.getDoubleValue();
operationImpactInstance.setChangeValueRelative(changeValueRelativeInstance);
}
}
}
JsonNode reportedImpactArray = propertiesValue6.get("reportedImpact");
if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) {
for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) {
OperationImpact operationImpactInstance2 = new OperationImpact();
propertiesInstance6.getReportedImpact().add(operationImpactInstance2);
JsonNode nameValue6 = reportedImpactValue.get("name");
if (nameValue6 != null && nameValue6 instanceof NullNode == false) {
String nameInstance6;
nameInstance6 = nameValue6.getTextValue();
operationImpactInstance2.setName(nameInstance6);
}
JsonNode unitValue2 = reportedImpactValue.get("unit");
if (unitValue2 != null && unitValue2 instanceof NullNode == false) {
String unitInstance2;
unitInstance2 = unitValue2.getTextValue();
operationImpactInstance2.setUnit(unitInstance2);
}
JsonNode changeValueAbsoluteValue2 = reportedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue2 != null && changeValueAbsoluteValue2 instanceof NullNode == false) {
double changeValueAbsoluteInstance2;
changeValueAbsoluteInstance2 = changeValueAbsoluteValue2.getDoubleValue();
operationImpactInstance2.setChangeValueAbsolute(changeValueAbsoluteInstance2);
}
JsonNode changeValueRelativeValue2 = reportedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue2 != null && changeValueRelativeValue2 instanceof NullNode == false) {
double changeValueRelativeInstance2;
changeValueRelativeInstance2 = changeValueRelativeValue2.getDoubleValue();
operationImpactInstance2.setChangeValueRelative(changeValueRelativeInstance2);
}
}
}
}
JsonNode idValue5 = recommendedIndexesValue.get("id");
if (idValue5 != null && idValue5 instanceof NullNode == false) {
String idInstance5;
idInstance5 = idValue5.getTextValue();
recommendedIndexInstance.setId(idInstance5);
}
JsonNode nameValue7 = recommendedIndexesValue.get("name");
if (nameValue7 != null && nameValue7 instanceof NullNode == false) {
String nameInstance7;
nameInstance7 = nameValue7.getTextValue();
recommendedIndexInstance.setName(nameInstance7);
}
JsonNode typeValue5 = recommendedIndexesValue.get("type");
if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
String typeInstance5;
typeInstance5 = typeValue5.getTextValue();
recommendedIndexInstance.setType(typeInstance5);
}
JsonNode locationValue5 = recommendedIndexesValue.get("location");
if (locationValue5 != null && locationValue5 instanceof NullNode == false) {
String locationInstance5;
locationInstance5 = locationValue5.getTextValue();
recommendedIndexInstance.setLocation(locationInstance5);
}
JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue.get("tags"));
if (tagsSequenceElement5 != null && tagsSequenceElement5 instanceof NullNode == false) {
Iterator> itr5 = tagsSequenceElement5.getFields();
while (itr5.hasNext()) {
Map.Entry property5 = itr5.next();
String tagsKey5 = property5.getKey();
String tagsValue5 = property5.getValue().getTextValue();
recommendedIndexInstance.getTags().put(tagsKey5, tagsValue5);
}
}
}
}
}
JsonNode idValue6 = tablesValue.get("id");
if (idValue6 != null && idValue6 instanceof NullNode == false) {
String idInstance6;
idInstance6 = idValue6.getTextValue();
tableInstance.setId(idInstance6);
}
JsonNode nameValue8 = tablesValue.get("name");
if (nameValue8 != null && nameValue8 instanceof NullNode == false) {
String nameInstance8;
nameInstance8 = nameValue8.getTextValue();
tableInstance.setName(nameInstance8);
}
JsonNode typeValue6 = tablesValue.get("type");
if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
String typeInstance6;
typeInstance6 = typeValue6.getTextValue();
tableInstance.setType(typeInstance6);
}
JsonNode locationValue6 = tablesValue.get("location");
if (locationValue6 != null && locationValue6 instanceof NullNode == false) {
String locationInstance6;
locationInstance6 = locationValue6.getTextValue();
tableInstance.setLocation(locationInstance6);
}
JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue.get("tags"));
if (tagsSequenceElement6 != null && tagsSequenceElement6 instanceof NullNode == false) {
Iterator> itr6 = tagsSequenceElement6.getFields();
while (itr6.hasNext()) {
Map.Entry property6 = itr6.next();
String tagsKey6 = property6.getKey();
String tagsValue6 = property6.getValue().getTextValue();
tableInstance.getTags().put(tagsKey6, tagsValue6);
}
}
}
}
}
JsonNode idValue7 = schemasValue.get("id");
if (idValue7 != null && idValue7 instanceof NullNode == false) {
String idInstance7;
idInstance7 = idValue7.getTextValue();
schemaInstance.setId(idInstance7);
}
JsonNode nameValue9 = schemasValue.get("name");
if (nameValue9 != null && nameValue9 instanceof NullNode == false) {
String nameInstance9;
nameInstance9 = nameValue9.getTextValue();
schemaInstance.setName(nameInstance9);
}
JsonNode typeValue7 = schemasValue.get("type");
if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
String typeInstance7;
typeInstance7 = typeValue7.getTextValue();
schemaInstance.setType(typeInstance7);
}
JsonNode locationValue7 = schemasValue.get("location");
if (locationValue7 != null && locationValue7 instanceof NullNode == false) {
String locationInstance7;
locationInstance7 = locationValue7.getTextValue();
schemaInstance.setLocation(locationInstance7);
}
JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags"));
if (tagsSequenceElement7 != null && tagsSequenceElement7 instanceof NullNode == false) {
Iterator> itr7 = tagsSequenceElement7.getFields();
while (itr7.hasNext()) {
Map.Entry property7 = itr7.next();
String tagsKey7 = property7.getKey();
String tagsValue7 = property7.getValue().getTextValue();
schemaInstance.getTags().put(tagsKey7, tagsValue7);
}
}
}
}
JsonNode defaultSecondaryLocationValue = propertiesValue.get("defaultSecondaryLocation");
if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) {
String defaultSecondaryLocationInstance;
defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue();
propertiesInstance.setDefaultSecondaryLocation(defaultSecondaryLocationInstance);
}
}
JsonNode idValue8 = responseDoc.get("id");
if (idValue8 != null && idValue8 instanceof NullNode == false) {
String idInstance8;
idInstance8 = idValue8.getTextValue();
databaseInstance.setId(idInstance8);
}
JsonNode nameValue10 = responseDoc.get("name");
if (nameValue10 != null && nameValue10 instanceof NullNode == false) {
String nameInstance10;
nameInstance10 = nameValue10.getTextValue();
databaseInstance.setName(nameInstance10);
}
JsonNode typeValue8 = responseDoc.get("type");
if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
String typeInstance8;
typeInstance8 = typeValue8.getTextValue();
databaseInstance.setType(typeInstance8);
}
JsonNode locationValue8 = responseDoc.get("location");
if (locationValue8 != null && locationValue8 instanceof NullNode == false) {
String locationInstance8;
locationInstance8 = locationValue8.getTextValue();
databaseInstance.setLocation(locationInstance8);
}
JsonNode tagsSequenceElement8 = ((JsonNode) responseDoc.get("tags"));
if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) {
Iterator> itr8 = tagsSequenceElement8.getFields();
while (itr8.hasNext()) {
Map.Entry property8 = itr8.next();
String tagsKey8 = property8.getKey();
String tagsValue8 = property8.getValue().getTextValue();
databaseInstance.getTags().put(tagsKey8, tagsValue8);
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("Location").length > 0) {
result.setOperationStatusLink(httpResponse.getFirstHeader("Location").getValue());
}
if (httpResponse.getHeaders("Retry-After").length > 0) {
result.setRetryAfter(DatatypeConverter.parseInt(httpResponse.getFirstHeader("Retry-After").getValue()));
}
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (statusCode == HttpStatus.SC_OK) {
result.setStatus(OperationStatus.Succeeded);
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
/**
* Gets the status of an Azure SQL Data Warehouse Database pause or resume
* operation.
*
* @param operationStatusLink Required. Location value returned by the Begin
* operation
* @return Response for long running Azure Sql Database operations.
*/
@Override
public Future getDatabaseActivationOperationStatusAsync(final String operationStatusLink) {
return this.getClient().getExecutorService().submit(new Callable() {
@Override
public DatabaseCreateOrUpdateResponse call() throws Exception {
return getDatabaseActivationOperationStatus(operationStatusLink);
}
});
}
/**
* Gets the status of an Azure SQL Data Warehouse Database pause or resume
* operation.
*
* @param operationStatusLink Required. Location value returned by the Begin
* operation
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public DatabaseCreateOrUpdateResponse getDatabaseActivationOperationStatus(String operationStatusLink) throws IOException, ServiceException {
// Validate
if (operationStatusLink == null) {
throw new NullPointerException("operationStatusLink");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap tracingParameters = new HashMap();
tracingParameters.put("operationStatusLink", operationStatusLink);
CloudTracing.enter(invocationId, this, "getDatabaseActivationOperationStatusAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + operationStatusLink;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpGet httpRequest = new HttpGet(url);
// Set Headers
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_ACCEPTED) {
ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
DatabaseCreateOrUpdateResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK || statusCode == HttpStatus.SC_ACCEPTED) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new DatabaseCreateOrUpdateResponse();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode responseDoc = null;
String responseDocContent = IOUtils.toString(responseContent);
if (responseDocContent == null == false && responseDocContent.length() > 0) {
responseDoc = objectMapper.readTree(responseDocContent);
}
if (responseDoc != null && responseDoc instanceof NullNode == false) {
ErrorResponse errorInstance = new ErrorResponse();
result.setError(errorInstance);
JsonNode codeValue = responseDoc.get("code");
if (codeValue != null && codeValue instanceof NullNode == false) {
String codeInstance;
codeInstance = codeValue.getTextValue();
errorInstance.setCode(codeInstance);
}
JsonNode messageValue = responseDoc.get("message");
if (messageValue != null && messageValue instanceof NullNode == false) {
String messageInstance;
messageInstance = messageValue.getTextValue();
errorInstance.setMessage(messageInstance);
}
JsonNode targetValue = responseDoc.get("target");
if (targetValue != null && targetValue instanceof NullNode == false) {
String targetInstance;
targetInstance = targetValue.getTextValue();
errorInstance.setTarget(targetInstance);
}
Database databaseInstance = new Database();
result.setDatabase(databaseInstance);
JsonNode propertiesValue = responseDoc.get("properties");
if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
DatabaseProperties propertiesInstance = new DatabaseProperties();
databaseInstance.setProperties(propertiesInstance);
JsonNode collationValue = propertiesValue.get("collation");
if (collationValue != null && collationValue instanceof NullNode == false) {
String collationInstance;
collationInstance = collationValue.getTextValue();
propertiesInstance.setCollation(collationInstance);
}
JsonNode creationDateValue = propertiesValue.get("creationDate");
if (creationDateValue != null && creationDateValue instanceof NullNode == false) {
Calendar creationDateInstance;
creationDateInstance = DatatypeConverter.parseDateTime(creationDateValue.getTextValue());
propertiesInstance.setCreationDate(creationDateInstance);
}
JsonNode currentServiceObjectiveIdValue = propertiesValue.get("currentServiceObjectiveId");
if (currentServiceObjectiveIdValue != null && currentServiceObjectiveIdValue instanceof NullNode == false) {
String currentServiceObjectiveIdInstance;
currentServiceObjectiveIdInstance = currentServiceObjectiveIdValue.getTextValue();
propertiesInstance.setCurrentServiceObjectiveId(currentServiceObjectiveIdInstance);
}
JsonNode databaseIdValue = propertiesValue.get("databaseId");
if (databaseIdValue != null && databaseIdValue instanceof NullNode == false) {
String databaseIdInstance;
databaseIdInstance = databaseIdValue.getTextValue();
propertiesInstance.setDatabaseId(databaseIdInstance);
}
JsonNode earliestRestoreDateValue = propertiesValue.get("earliestRestoreDate");
if (earliestRestoreDateValue != null && earliestRestoreDateValue instanceof NullNode == false) {
Calendar earliestRestoreDateInstance;
earliestRestoreDateInstance = DatatypeConverter.parseDateTime(earliestRestoreDateValue.getTextValue());
propertiesInstance.setEarliestRestoreDate(earliestRestoreDateInstance);
}
JsonNode editionValue = propertiesValue.get("edition");
if (editionValue != null && editionValue instanceof NullNode == false) {
String editionInstance;
editionInstance = editionValue.getTextValue();
propertiesInstance.setEdition(editionInstance);
}
JsonNode maxSizeBytesValue = propertiesValue.get("maxSizeBytes");
if (maxSizeBytesValue != null && maxSizeBytesValue instanceof NullNode == false) {
long maxSizeBytesInstance;
maxSizeBytesInstance = maxSizeBytesValue.getLongValue();
propertiesInstance.setMaxSizeBytes(maxSizeBytesInstance);
}
JsonNode requestedServiceObjectiveIdValue = propertiesValue.get("requestedServiceObjectiveId");
if (requestedServiceObjectiveIdValue != null && requestedServiceObjectiveIdValue instanceof NullNode == false) {
String requestedServiceObjectiveIdInstance;
requestedServiceObjectiveIdInstance = requestedServiceObjectiveIdValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveId(requestedServiceObjectiveIdInstance);
}
JsonNode requestedServiceObjectiveNameValue = propertiesValue.get("requestedServiceObjectiveName");
if (requestedServiceObjectiveNameValue != null && requestedServiceObjectiveNameValue instanceof NullNode == false) {
String requestedServiceObjectiveNameInstance;
requestedServiceObjectiveNameInstance = requestedServiceObjectiveNameValue.getTextValue();
propertiesInstance.setRequestedServiceObjectiveName(requestedServiceObjectiveNameInstance);
}
JsonNode serviceLevelObjectiveValue = propertiesValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue != null && serviceLevelObjectiveValue instanceof NullNode == false) {
String serviceLevelObjectiveInstance;
serviceLevelObjectiveInstance = serviceLevelObjectiveValue.getTextValue();
propertiesInstance.setServiceObjective(serviceLevelObjectiveInstance);
}
JsonNode statusValue = propertiesValue.get("status");
if (statusValue != null && statusValue instanceof NullNode == false) {
String statusInstance;
statusInstance = statusValue.getTextValue();
propertiesInstance.setStatus(statusInstance);
}
JsonNode elasticPoolNameValue = propertiesValue.get("elasticPoolName");
if (elasticPoolNameValue != null && elasticPoolNameValue instanceof NullNode == false) {
String elasticPoolNameInstance;
elasticPoolNameInstance = elasticPoolNameValue.getTextValue();
propertiesInstance.setElasticPoolName(elasticPoolNameInstance);
}
JsonNode serviceTierAdvisorsArray = propertiesValue.get("serviceTierAdvisors");
if (serviceTierAdvisorsArray != null && serviceTierAdvisorsArray instanceof NullNode == false) {
for (JsonNode serviceTierAdvisorsValue : ((ArrayNode) serviceTierAdvisorsArray)) {
ServiceTierAdvisor serviceTierAdvisorInstance = new ServiceTierAdvisor();
propertiesInstance.getServiceTierAdvisors().add(serviceTierAdvisorInstance);
JsonNode propertiesValue2 = serviceTierAdvisorsValue.get("properties");
if (propertiesValue2 != null && propertiesValue2 instanceof NullNode == false) {
ServiceTierAdvisorProperties propertiesInstance2 = new ServiceTierAdvisorProperties();
serviceTierAdvisorInstance.setProperties(propertiesInstance2);
JsonNode observationPeriodStartValue = propertiesValue2.get("observationPeriodStart");
if (observationPeriodStartValue != null && observationPeriodStartValue instanceof NullNode == false) {
Calendar observationPeriodStartInstance;
observationPeriodStartInstance = DatatypeConverter.parseDateTime(observationPeriodStartValue.getTextValue());
propertiesInstance2.setObservationPeriodStart(observationPeriodStartInstance);
}
JsonNode observationPeriodEndValue = propertiesValue2.get("observationPeriodEnd");
if (observationPeriodEndValue != null && observationPeriodEndValue instanceof NullNode == false) {
Calendar observationPeriodEndInstance;
observationPeriodEndInstance = DatatypeConverter.parseDateTime(observationPeriodEndValue.getTextValue());
propertiesInstance2.setObservationPeriodEnd(observationPeriodEndInstance);
}
JsonNode activeTimeRatioValue = propertiesValue2.get("activeTimeRatio");
if (activeTimeRatioValue != null && activeTimeRatioValue instanceof NullNode == false) {
double activeTimeRatioInstance;
activeTimeRatioInstance = activeTimeRatioValue.getDoubleValue();
propertiesInstance2.setActiveTimeRatio(activeTimeRatioInstance);
}
JsonNode minDtuValue = propertiesValue2.get("minDtu");
if (minDtuValue != null && minDtuValue instanceof NullNode == false) {
double minDtuInstance;
minDtuInstance = minDtuValue.getDoubleValue();
propertiesInstance2.setMinDtu(minDtuInstance);
}
JsonNode avgDtuValue = propertiesValue2.get("avgDtu");
if (avgDtuValue != null && avgDtuValue instanceof NullNode == false) {
double avgDtuInstance;
avgDtuInstance = avgDtuValue.getDoubleValue();
propertiesInstance2.setAvgDtu(avgDtuInstance);
}
JsonNode maxDtuValue = propertiesValue2.get("maxDtu");
if (maxDtuValue != null && maxDtuValue instanceof NullNode == false) {
double maxDtuInstance;
maxDtuInstance = maxDtuValue.getDoubleValue();
propertiesInstance2.setMaxDtu(maxDtuInstance);
}
JsonNode maxSizeInGBValue = propertiesValue2.get("maxSizeInGB");
if (maxSizeInGBValue != null && maxSizeInGBValue instanceof NullNode == false) {
double maxSizeInGBInstance;
maxSizeInGBInstance = maxSizeInGBValue.getDoubleValue();
propertiesInstance2.setMaxSizeInGB(maxSizeInGBInstance);
}
JsonNode serviceLevelObjectiveUsageMetricsArray = propertiesValue2.get("serviceLevelObjectiveUsageMetrics");
if (serviceLevelObjectiveUsageMetricsArray != null && serviceLevelObjectiveUsageMetricsArray instanceof NullNode == false) {
for (JsonNode serviceLevelObjectiveUsageMetricsValue : ((ArrayNode) serviceLevelObjectiveUsageMetricsArray)) {
SloUsageMetric sloUsageMetricInstance = new SloUsageMetric();
propertiesInstance2.getServiceLevelObjectiveUsageMetrics().add(sloUsageMetricInstance);
JsonNode serviceLevelObjectiveValue2 = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjective");
if (serviceLevelObjectiveValue2 != null && serviceLevelObjectiveValue2 instanceof NullNode == false) {
String serviceLevelObjectiveInstance2;
serviceLevelObjectiveInstance2 = serviceLevelObjectiveValue2.getTextValue();
sloUsageMetricInstance.setServiceLevelObjective(serviceLevelObjectiveInstance2);
}
JsonNode serviceLevelObjectiveIdValue = serviceLevelObjectiveUsageMetricsValue.get("serviceLevelObjectiveId");
if (serviceLevelObjectiveIdValue != null && serviceLevelObjectiveIdValue instanceof NullNode == false) {
String serviceLevelObjectiveIdInstance;
serviceLevelObjectiveIdInstance = serviceLevelObjectiveIdValue.getTextValue();
sloUsageMetricInstance.setServiceLevelObjectiveId(serviceLevelObjectiveIdInstance);
}
JsonNode inRangeTimeRatioValue = serviceLevelObjectiveUsageMetricsValue.get("inRangeTimeRatio");
if (inRangeTimeRatioValue != null && inRangeTimeRatioValue instanceof NullNode == false) {
double inRangeTimeRatioInstance;
inRangeTimeRatioInstance = inRangeTimeRatioValue.getDoubleValue();
sloUsageMetricInstance.setInRangeTimeRatio(inRangeTimeRatioInstance);
}
JsonNode idValue = serviceLevelObjectiveUsageMetricsValue.get("id");
if (idValue != null && idValue instanceof NullNode == false) {
String idInstance;
idInstance = idValue.getTextValue();
sloUsageMetricInstance.setId(idInstance);
}
JsonNode nameValue = serviceLevelObjectiveUsageMetricsValue.get("name");
if (nameValue != null && nameValue instanceof NullNode == false) {
String nameInstance;
nameInstance = nameValue.getTextValue();
sloUsageMetricInstance.setName(nameInstance);
}
JsonNode typeValue = serviceLevelObjectiveUsageMetricsValue.get("type");
if (typeValue != null && typeValue instanceof NullNode == false) {
String typeInstance;
typeInstance = typeValue.getTextValue();
sloUsageMetricInstance.setType(typeInstance);
}
JsonNode locationValue = serviceLevelObjectiveUsageMetricsValue.get("location");
if (locationValue != null && locationValue instanceof NullNode == false) {
String locationInstance;
locationInstance = locationValue.getTextValue();
sloUsageMetricInstance.setLocation(locationInstance);
}
JsonNode tagsSequenceElement = ((JsonNode) serviceLevelObjectiveUsageMetricsValue.get("tags"));
if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) {
Iterator> itr = tagsSequenceElement.getFields();
while (itr.hasNext()) {
Map.Entry property = itr.next();
String tagsKey = property.getKey();
String tagsValue = property.getValue().getTextValue();
sloUsageMetricInstance.getTags().put(tagsKey, tagsValue);
}
}
}
}
JsonNode currentServiceLevelObjectiveValue = propertiesValue2.get("currentServiceLevelObjective");
if (currentServiceLevelObjectiveValue != null && currentServiceLevelObjectiveValue instanceof NullNode == false) {
String currentServiceLevelObjectiveInstance;
currentServiceLevelObjectiveInstance = currentServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjective(currentServiceLevelObjectiveInstance);
}
JsonNode currentServiceLevelObjectiveIdValue = propertiesValue2.get("currentServiceLevelObjectiveId");
if (currentServiceLevelObjectiveIdValue != null && currentServiceLevelObjectiveIdValue instanceof NullNode == false) {
String currentServiceLevelObjectiveIdInstance;
currentServiceLevelObjectiveIdInstance = currentServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setCurrentServiceLevelObjectiveId(currentServiceLevelObjectiveIdInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjective");
if (usageBasedRecommendationServiceLevelObjectiveValue != null && usageBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveInstance;
usageBasedRecommendationServiceLevelObjectiveInstance = usageBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjective(usageBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode usageBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("usageBasedRecommendationServiceLevelObjectiveId");
if (usageBasedRecommendationServiceLevelObjectiveIdValue != null && usageBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String usageBasedRecommendationServiceLevelObjectiveIdInstance;
usageBasedRecommendationServiceLevelObjectiveIdInstance = usageBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setUsageBasedRecommendationServiceLevelObjectiveId(usageBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjective");
if (databaseSizeBasedRecommendationServiceLevelObjectiveValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveInstance = databaseSizeBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjective(databaseSizeBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode databaseSizeBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("databaseSizeBasedRecommendationServiceLevelObjectiveId");
if (databaseSizeBasedRecommendationServiceLevelObjectiveIdValue != null && databaseSizeBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance;
databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance = databaseSizeBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDatabaseSizeBasedRecommendationServiceLevelObjectiveId(databaseSizeBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjective");
if (disasterPlanBasedRecommendationServiceLevelObjectiveValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveInstance = disasterPlanBasedRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjective(disasterPlanBasedRecommendationServiceLevelObjectiveInstance);
}
JsonNode disasterPlanBasedRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("disasterPlanBasedRecommendationServiceLevelObjectiveId");
if (disasterPlanBasedRecommendationServiceLevelObjectiveIdValue != null && disasterPlanBasedRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance;
disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance = disasterPlanBasedRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setDisasterPlanBasedRecommendationServiceLevelObjectiveId(disasterPlanBasedRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveValue = propertiesValue2.get("overallRecommendationServiceLevelObjective");
if (overallRecommendationServiceLevelObjectiveValue != null && overallRecommendationServiceLevelObjectiveValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveInstance;
overallRecommendationServiceLevelObjectiveInstance = overallRecommendationServiceLevelObjectiveValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjective(overallRecommendationServiceLevelObjectiveInstance);
}
JsonNode overallRecommendationServiceLevelObjectiveIdValue = propertiesValue2.get("overallRecommendationServiceLevelObjectiveId");
if (overallRecommendationServiceLevelObjectiveIdValue != null && overallRecommendationServiceLevelObjectiveIdValue instanceof NullNode == false) {
String overallRecommendationServiceLevelObjectiveIdInstance;
overallRecommendationServiceLevelObjectiveIdInstance = overallRecommendationServiceLevelObjectiveIdValue.getTextValue();
propertiesInstance2.setOverallRecommendationServiceLevelObjectiveId(overallRecommendationServiceLevelObjectiveIdInstance);
}
JsonNode confidenceValue = propertiesValue2.get("confidence");
if (confidenceValue != null && confidenceValue instanceof NullNode == false) {
double confidenceInstance;
confidenceInstance = confidenceValue.getDoubleValue();
propertiesInstance2.setConfidence(confidenceInstance);
}
}
JsonNode idValue2 = serviceTierAdvisorsValue.get("id");
if (idValue2 != null && idValue2 instanceof NullNode == false) {
String idInstance2;
idInstance2 = idValue2.getTextValue();
serviceTierAdvisorInstance.setId(idInstance2);
}
JsonNode nameValue2 = serviceTierAdvisorsValue.get("name");
if (nameValue2 != null && nameValue2 instanceof NullNode == false) {
String nameInstance2;
nameInstance2 = nameValue2.getTextValue();
serviceTierAdvisorInstance.setName(nameInstance2);
}
JsonNode typeValue2 = serviceTierAdvisorsValue.get("type");
if (typeValue2 != null && typeValue2 instanceof NullNode == false) {
String typeInstance2;
typeInstance2 = typeValue2.getTextValue();
serviceTierAdvisorInstance.setType(typeInstance2);
}
JsonNode locationValue2 = serviceTierAdvisorsValue.get("location");
if (locationValue2 != null && locationValue2 instanceof NullNode == false) {
String locationInstance2;
locationInstance2 = locationValue2.getTextValue();
serviceTierAdvisorInstance.setLocation(locationInstance2);
}
JsonNode tagsSequenceElement2 = ((JsonNode) serviceTierAdvisorsValue.get("tags"));
if (tagsSequenceElement2 != null && tagsSequenceElement2 instanceof NullNode == false) {
Iterator> itr2 = tagsSequenceElement2.getFields();
while (itr2.hasNext()) {
Map.Entry property2 = itr2.next();
String tagsKey2 = property2.getKey();
String tagsValue2 = property2.getValue().getTextValue();
serviceTierAdvisorInstance.getTags().put(tagsKey2, tagsValue2);
}
}
}
}
JsonNode upgradeHintValue = propertiesValue.get("upgradeHint");
if (upgradeHintValue != null && upgradeHintValue instanceof NullNode == false) {
UpgradeHint upgradeHintInstance = new UpgradeHint();
propertiesInstance.setUpgradeHint(upgradeHintInstance);
JsonNode targetServiceLevelObjectiveValue = upgradeHintValue.get("targetServiceLevelObjective");
if (targetServiceLevelObjectiveValue != null && targetServiceLevelObjectiveValue instanceof NullNode == false) {
String targetServiceLevelObjectiveInstance;
targetServiceLevelObjectiveInstance = targetServiceLevelObjectiveValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjective(targetServiceLevelObjectiveInstance);
}
JsonNode targetServiceLevelObjectiveIdValue = upgradeHintValue.get("targetServiceLevelObjectiveId");
if (targetServiceLevelObjectiveIdValue != null && targetServiceLevelObjectiveIdValue instanceof NullNode == false) {
String targetServiceLevelObjectiveIdInstance;
targetServiceLevelObjectiveIdInstance = targetServiceLevelObjectiveIdValue.getTextValue();
upgradeHintInstance.setTargetServiceLevelObjectiveId(targetServiceLevelObjectiveIdInstance);
}
JsonNode idValue3 = upgradeHintValue.get("id");
if (idValue3 != null && idValue3 instanceof NullNode == false) {
String idInstance3;
idInstance3 = idValue3.getTextValue();
upgradeHintInstance.setId(idInstance3);
}
JsonNode nameValue3 = upgradeHintValue.get("name");
if (nameValue3 != null && nameValue3 instanceof NullNode == false) {
String nameInstance3;
nameInstance3 = nameValue3.getTextValue();
upgradeHintInstance.setName(nameInstance3);
}
JsonNode typeValue3 = upgradeHintValue.get("type");
if (typeValue3 != null && typeValue3 instanceof NullNode == false) {
String typeInstance3;
typeInstance3 = typeValue3.getTextValue();
upgradeHintInstance.setType(typeInstance3);
}
JsonNode locationValue3 = upgradeHintValue.get("location");
if (locationValue3 != null && locationValue3 instanceof NullNode == false) {
String locationInstance3;
locationInstance3 = locationValue3.getTextValue();
upgradeHintInstance.setLocation(locationInstance3);
}
JsonNode tagsSequenceElement3 = ((JsonNode) upgradeHintValue.get("tags"));
if (tagsSequenceElement3 != null && tagsSequenceElement3 instanceof NullNode == false) {
Iterator> itr3 = tagsSequenceElement3.getFields();
while (itr3.hasNext()) {
Map.Entry property3 = itr3.next();
String tagsKey3 = property3.getKey();
String tagsValue3 = property3.getValue().getTextValue();
upgradeHintInstance.getTags().put(tagsKey3, tagsValue3);
}
}
}
JsonNode schemasArray = propertiesValue.get("schemas");
if (schemasArray != null && schemasArray instanceof NullNode == false) {
for (JsonNode schemasValue : ((ArrayNode) schemasArray)) {
Schema schemaInstance = new Schema();
propertiesInstance.getSchemas().add(schemaInstance);
JsonNode propertiesValue3 = schemasValue.get("properties");
if (propertiesValue3 != null && propertiesValue3 instanceof NullNode == false) {
SchemaProperties propertiesInstance3 = new SchemaProperties();
schemaInstance.setProperties(propertiesInstance3);
JsonNode tablesArray = propertiesValue3.get("tables");
if (tablesArray != null && tablesArray instanceof NullNode == false) {
for (JsonNode tablesValue : ((ArrayNode) tablesArray)) {
Table tableInstance = new Table();
propertiesInstance3.getTables().add(tableInstance);
JsonNode propertiesValue4 = tablesValue.get("properties");
if (propertiesValue4 != null && propertiesValue4 instanceof NullNode == false) {
TableProperties propertiesInstance4 = new TableProperties();
tableInstance.setProperties(propertiesInstance4);
JsonNode tableTypeValue = propertiesValue4.get("tableType");
if (tableTypeValue != null && tableTypeValue instanceof NullNode == false) {
String tableTypeInstance;
tableTypeInstance = tableTypeValue.getTextValue();
propertiesInstance4.setTableType(tableTypeInstance);
}
JsonNode columnsArray = propertiesValue4.get("columns");
if (columnsArray != null && columnsArray instanceof NullNode == false) {
for (JsonNode columnsValue : ((ArrayNode) columnsArray)) {
Column columnInstance = new Column();
propertiesInstance4.getColumns().add(columnInstance);
JsonNode propertiesValue5 = columnsValue.get("properties");
if (propertiesValue5 != null && propertiesValue5 instanceof NullNode == false) {
ColumnProperties propertiesInstance5 = new ColumnProperties();
columnInstance.setProperties(propertiesInstance5);
JsonNode columnTypeValue = propertiesValue5.get("columnType");
if (columnTypeValue != null && columnTypeValue instanceof NullNode == false) {
String columnTypeInstance;
columnTypeInstance = columnTypeValue.getTextValue();
propertiesInstance5.setColumnType(columnTypeInstance);
}
}
JsonNode idValue4 = columnsValue.get("id");
if (idValue4 != null && idValue4 instanceof NullNode == false) {
String idInstance4;
idInstance4 = idValue4.getTextValue();
columnInstance.setId(idInstance4);
}
JsonNode nameValue4 = columnsValue.get("name");
if (nameValue4 != null && nameValue4 instanceof NullNode == false) {
String nameInstance4;
nameInstance4 = nameValue4.getTextValue();
columnInstance.setName(nameInstance4);
}
JsonNode typeValue4 = columnsValue.get("type");
if (typeValue4 != null && typeValue4 instanceof NullNode == false) {
String typeInstance4;
typeInstance4 = typeValue4.getTextValue();
columnInstance.setType(typeInstance4);
}
JsonNode locationValue4 = columnsValue.get("location");
if (locationValue4 != null && locationValue4 instanceof NullNode == false) {
String locationInstance4;
locationInstance4 = locationValue4.getTextValue();
columnInstance.setLocation(locationInstance4);
}
JsonNode tagsSequenceElement4 = ((JsonNode) columnsValue.get("tags"));
if (tagsSequenceElement4 != null && tagsSequenceElement4 instanceof NullNode == false) {
Iterator> itr4 = tagsSequenceElement4.getFields();
while (itr4.hasNext()) {
Map.Entry property4 = itr4.next();
String tagsKey4 = property4.getKey();
String tagsValue4 = property4.getValue().getTextValue();
columnInstance.getTags().put(tagsKey4, tagsValue4);
}
}
}
}
JsonNode recommendedIndexesArray = propertiesValue4.get("recommendedIndexes");
if (recommendedIndexesArray != null && recommendedIndexesArray instanceof NullNode == false) {
for (JsonNode recommendedIndexesValue : ((ArrayNode) recommendedIndexesArray)) {
RecommendedIndex recommendedIndexInstance = new RecommendedIndex();
propertiesInstance4.getRecommendedIndexes().add(recommendedIndexInstance);
JsonNode propertiesValue6 = recommendedIndexesValue.get("properties");
if (propertiesValue6 != null && propertiesValue6 instanceof NullNode == false) {
RecommendedIndexProperties propertiesInstance6 = new RecommendedIndexProperties();
recommendedIndexInstance.setProperties(propertiesInstance6);
JsonNode actionValue = propertiesValue6.get("action");
if (actionValue != null && actionValue instanceof NullNode == false) {
String actionInstance;
actionInstance = actionValue.getTextValue();
propertiesInstance6.setAction(actionInstance);
}
JsonNode stateValue = propertiesValue6.get("state");
if (stateValue != null && stateValue instanceof NullNode == false) {
String stateInstance;
stateInstance = stateValue.getTextValue();
propertiesInstance6.setState(stateInstance);
}
JsonNode createdValue = propertiesValue6.get("created");
if (createdValue != null && createdValue instanceof NullNode == false) {
Calendar createdInstance;
createdInstance = DatatypeConverter.parseDateTime(createdValue.getTextValue());
propertiesInstance6.setCreated(createdInstance);
}
JsonNode lastModifiedValue = propertiesValue6.get("lastModified");
if (lastModifiedValue != null && lastModifiedValue instanceof NullNode == false) {
Calendar lastModifiedInstance;
lastModifiedInstance = DatatypeConverter.parseDateTime(lastModifiedValue.getTextValue());
propertiesInstance6.setLastModified(lastModifiedInstance);
}
JsonNode indexTypeValue = propertiesValue6.get("indexType");
if (indexTypeValue != null && indexTypeValue instanceof NullNode == false) {
String indexTypeInstance;
indexTypeInstance = indexTypeValue.getTextValue();
propertiesInstance6.setIndexType(indexTypeInstance);
}
JsonNode schemaValue = propertiesValue6.get("schema");
if (schemaValue != null && schemaValue instanceof NullNode == false) {
String schemaInstance2;
schemaInstance2 = schemaValue.getTextValue();
propertiesInstance6.setSchema(schemaInstance2);
}
JsonNode tableValue = propertiesValue6.get("table");
if (tableValue != null && tableValue instanceof NullNode == false) {
String tableInstance2;
tableInstance2 = tableValue.getTextValue();
propertiesInstance6.setTable(tableInstance2);
}
JsonNode columnsArray2 = propertiesValue6.get("columns");
if (columnsArray2 != null && columnsArray2 instanceof NullNode == false) {
for (JsonNode columnsValue2 : ((ArrayNode) columnsArray2)) {
propertiesInstance6.getColumns().add(columnsValue2.getTextValue());
}
}
JsonNode includedColumnsArray = propertiesValue6.get("includedColumns");
if (includedColumnsArray != null && includedColumnsArray instanceof NullNode == false) {
for (JsonNode includedColumnsValue : ((ArrayNode) includedColumnsArray)) {
propertiesInstance6.getIncludedColumns().add(includedColumnsValue.getTextValue());
}
}
JsonNode indexScriptValue = propertiesValue6.get("indexScript");
if (indexScriptValue != null && indexScriptValue instanceof NullNode == false) {
String indexScriptInstance;
indexScriptInstance = indexScriptValue.getTextValue();
propertiesInstance6.setIndexScript(indexScriptInstance);
}
JsonNode estimatedImpactArray = propertiesValue6.get("estimatedImpact");
if (estimatedImpactArray != null && estimatedImpactArray instanceof NullNode == false) {
for (JsonNode estimatedImpactValue : ((ArrayNode) estimatedImpactArray)) {
OperationImpact operationImpactInstance = new OperationImpact();
propertiesInstance6.getEstimatedImpact().add(operationImpactInstance);
JsonNode nameValue5 = estimatedImpactValue.get("name");
if (nameValue5 != null && nameValue5 instanceof NullNode == false) {
String nameInstance5;
nameInstance5 = nameValue5.getTextValue();
operationImpactInstance.setName(nameInstance5);
}
JsonNode unitValue = estimatedImpactValue.get("unit");
if (unitValue != null && unitValue instanceof NullNode == false) {
String unitInstance;
unitInstance = unitValue.getTextValue();
operationImpactInstance.setUnit(unitInstance);
}
JsonNode changeValueAbsoluteValue = estimatedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue != null && changeValueAbsoluteValue instanceof NullNode == false) {
double changeValueAbsoluteInstance;
changeValueAbsoluteInstance = changeValueAbsoluteValue.getDoubleValue();
operationImpactInstance.setChangeValueAbsolute(changeValueAbsoluteInstance);
}
JsonNode changeValueRelativeValue = estimatedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue != null && changeValueRelativeValue instanceof NullNode == false) {
double changeValueRelativeInstance;
changeValueRelativeInstance = changeValueRelativeValue.getDoubleValue();
operationImpactInstance.setChangeValueRelative(changeValueRelativeInstance);
}
}
}
JsonNode reportedImpactArray = propertiesValue6.get("reportedImpact");
if (reportedImpactArray != null && reportedImpactArray instanceof NullNode == false) {
for (JsonNode reportedImpactValue : ((ArrayNode) reportedImpactArray)) {
OperationImpact operationImpactInstance2 = new OperationImpact();
propertiesInstance6.getReportedImpact().add(operationImpactInstance2);
JsonNode nameValue6 = reportedImpactValue.get("name");
if (nameValue6 != null && nameValue6 instanceof NullNode == false) {
String nameInstance6;
nameInstance6 = nameValue6.getTextValue();
operationImpactInstance2.setName(nameInstance6);
}
JsonNode unitValue2 = reportedImpactValue.get("unit");
if (unitValue2 != null && unitValue2 instanceof NullNode == false) {
String unitInstance2;
unitInstance2 = unitValue2.getTextValue();
operationImpactInstance2.setUnit(unitInstance2);
}
JsonNode changeValueAbsoluteValue2 = reportedImpactValue.get("changeValueAbsolute");
if (changeValueAbsoluteValue2 != null && changeValueAbsoluteValue2 instanceof NullNode == false) {
double changeValueAbsoluteInstance2;
changeValueAbsoluteInstance2 = changeValueAbsoluteValue2.getDoubleValue();
operationImpactInstance2.setChangeValueAbsolute(changeValueAbsoluteInstance2);
}
JsonNode changeValueRelativeValue2 = reportedImpactValue.get("changeValueRelative");
if (changeValueRelativeValue2 != null && changeValueRelativeValue2 instanceof NullNode == false) {
double changeValueRelativeInstance2;
changeValueRelativeInstance2 = changeValueRelativeValue2.getDoubleValue();
operationImpactInstance2.setChangeValueRelative(changeValueRelativeInstance2);
}
}
}
}
JsonNode idValue5 = recommendedIndexesValue.get("id");
if (idValue5 != null && idValue5 instanceof NullNode == false) {
String idInstance5;
idInstance5 = idValue5.getTextValue();
recommendedIndexInstance.setId(idInstance5);
}
JsonNode nameValue7 = recommendedIndexesValue.get("name");
if (nameValue7 != null && nameValue7 instanceof NullNode == false) {
String nameInstance7;
nameInstance7 = nameValue7.getTextValue();
recommendedIndexInstance.setName(nameInstance7);
}
JsonNode typeValue5 = recommendedIndexesValue.get("type");
if (typeValue5 != null && typeValue5 instanceof NullNode == false) {
String typeInstance5;
typeInstance5 = typeValue5.getTextValue();
recommendedIndexInstance.setType(typeInstance5);
}
JsonNode locationValue5 = recommendedIndexesValue.get("location");
if (locationValue5 != null && locationValue5 instanceof NullNode == false) {
String locationInstance5;
locationInstance5 = locationValue5.getTextValue();
recommendedIndexInstance.setLocation(locationInstance5);
}
JsonNode tagsSequenceElement5 = ((JsonNode) recommendedIndexesValue.get("tags"));
if (tagsSequenceElement5 != null && tagsSequenceElement5 instanceof NullNode == false) {
Iterator> itr5 = tagsSequenceElement5.getFields();
while (itr5.hasNext()) {
Map.Entry property5 = itr5.next();
String tagsKey5 = property5.getKey();
String tagsValue5 = property5.getValue().getTextValue();
recommendedIndexInstance.getTags().put(tagsKey5, tagsValue5);
}
}
}
}
}
JsonNode idValue6 = tablesValue.get("id");
if (idValue6 != null && idValue6 instanceof NullNode == false) {
String idInstance6;
idInstance6 = idValue6.getTextValue();
tableInstance.setId(idInstance6);
}
JsonNode nameValue8 = tablesValue.get("name");
if (nameValue8 != null && nameValue8 instanceof NullNode == false) {
String nameInstance8;
nameInstance8 = nameValue8.getTextValue();
tableInstance.setName(nameInstance8);
}
JsonNode typeValue6 = tablesValue.get("type");
if (typeValue6 != null && typeValue6 instanceof NullNode == false) {
String typeInstance6;
typeInstance6 = typeValue6.getTextValue();
tableInstance.setType(typeInstance6);
}
JsonNode locationValue6 = tablesValue.get("location");
if (locationValue6 != null && locationValue6 instanceof NullNode == false) {
String locationInstance6;
locationInstance6 = locationValue6.getTextValue();
tableInstance.setLocation(locationInstance6);
}
JsonNode tagsSequenceElement6 = ((JsonNode) tablesValue.get("tags"));
if (tagsSequenceElement6 != null && tagsSequenceElement6 instanceof NullNode == false) {
Iterator> itr6 = tagsSequenceElement6.getFields();
while (itr6.hasNext()) {
Map.Entry property6 = itr6.next();
String tagsKey6 = property6.getKey();
String tagsValue6 = property6.getValue().getTextValue();
tableInstance.getTags().put(tagsKey6, tagsValue6);
}
}
}
}
}
JsonNode idValue7 = schemasValue.get("id");
if (idValue7 != null && idValue7 instanceof NullNode == false) {
String idInstance7;
idInstance7 = idValue7.getTextValue();
schemaInstance.setId(idInstance7);
}
JsonNode nameValue9 = schemasValue.get("name");
if (nameValue9 != null && nameValue9 instanceof NullNode == false) {
String nameInstance9;
nameInstance9 = nameValue9.getTextValue();
schemaInstance.setName(nameInstance9);
}
JsonNode typeValue7 = schemasValue.get("type");
if (typeValue7 != null && typeValue7 instanceof NullNode == false) {
String typeInstance7;
typeInstance7 = typeValue7.getTextValue();
schemaInstance.setType(typeInstance7);
}
JsonNode locationValue7 = schemasValue.get("location");
if (locationValue7 != null && locationValue7 instanceof NullNode == false) {
String locationInstance7;
locationInstance7 = locationValue7.getTextValue();
schemaInstance.setLocation(locationInstance7);
}
JsonNode tagsSequenceElement7 = ((JsonNode) schemasValue.get("tags"));
if (tagsSequenceElement7 != null && tagsSequenceElement7 instanceof NullNode == false) {
Iterator> itr7 = tagsSequenceElement7.getFields();
while (itr7.hasNext()) {
Map.Entry property7 = itr7.next();
String tagsKey7 = property7.getKey();
String tagsValue7 = property7.getValue().getTextValue();
schemaInstance.getTags().put(tagsKey7, tagsValue7);
}
}
}
}
JsonNode defaultSecondaryLocationValue = propertiesValue.get("defaultSecondaryLocation");
if (defaultSecondaryLocationValue != null && defaultSecondaryLocationValue instanceof NullNode == false) {
String defaultSecondaryLocationInstance;
defaultSecondaryLocationInstance = defaultSecondaryLocationValue.getTextValue();
propertiesInstance.setDefaultSecondaryLocation(defaultSecondaryLocationInstance);
}
}
JsonNode idValue8 = responseDoc.get("id");
if (idValue8 != null && idValue8 instanceof NullNode == false) {
String idInstance8;
idInstance8 = idValue8.getTextValue();
databaseInstance.setId(idInstance8);
}
JsonNode nameValue10 = responseDoc.get("name");
if (nameValue10 != null && nameValue10 instanceof NullNode == false) {
String nameInstance10;
nameInstance10 = nameValue10.getTextValue();
databaseInstance.setName(nameInstance10);
}
JsonNode typeValue8 = responseDoc.get("type");
if (typeValue8 != null && typeValue8 instanceof NullNode == false) {
String typeInstance8;
typeInstance8 = typeValue8.getTextValue();
databaseInstance.setType(typeInstance8);
}
JsonNode locationValue8 = responseDoc.get("location");
if (locationValue8 != null && locationValue8 instanceof NullNode == false) {
String locationInstance8;
locationInstance8 = locationValue8.getTextValue();
databaseInstance.setLocation(locationInstance8);
}
JsonNode tagsSequenceElement8 = ((JsonNode) responseDoc.get("tags"));
if (tagsSequenceElement8 != null && tagsSequenceElement8 instanceof NullNode == false) {
Iterator> itr8 = tagsSequenceElement8.getFields();
while (itr8.hasNext()) {
Map.Entry property8 = itr8.next();
String tagsKey8 = property8.getKey();
String tagsValue8 = property8.getValue().getTextValue();
databaseInstance.getTags().put(tagsKey8, tagsValue8);
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (statusCode == HttpStatus.SC_OK) {
result.setStatus(OperationStatus.Succeeded);
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
/**
* Start an Azure SQL Data Warehouse database pause operation.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to pause.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public Future pauseAsync(final String resourceGroupName, final String serverName, final String databaseName) {
return this.getClient().getExecutorService().submit(new Callable() {
@Override
public DatabaseCreateOrUpdateResponse call() throws Exception {
return pause(resourceGroupName, serverName, databaseName);
}
});
}
/**
* Start an Azure SQL Data Warehouse database pause operation.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to pause.
* @throws InterruptedException Thrown when a thread is waiting, sleeping,
* or otherwise occupied, and the thread is interrupted, either before or
* during the activity. Occasionally a method may wish to test whether the
* current thread has been interrupted, and if so, to immediately throw
* this exception. The following code can be used to achieve this effect:
* @throws ExecutionException Thrown when attempting to retrieve the result
* of a task that aborted by throwing an exception. This exception can be
* inspected using the Throwable.getCause() method.
* @throws IOException Thrown if there was an error setting up tracing for
* the request.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public DatabaseCreateOrUpdateResponse pause(String resourceGroupName, String serverName, String databaseName) throws InterruptedException, ExecutionException, IOException {
SqlManagementClient client2 = this.getClient();
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap tracingParameters = new HashMap();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("serverName", serverName);
tracingParameters.put("databaseName", databaseName);
CloudTracing.enter(invocationId, this, "pauseAsync", tracingParameters);
}
try {
if (shouldTrace) {
client2 = this.getClient().withRequestFilterLast(new ClientRequestTrackingHandler(invocationId)).withResponseFilterLast(new ClientRequestTrackingHandler(invocationId));
}
DatabaseCreateOrUpdateResponse response = client2.getDatabaseActivationOperations().beginPauseAsync(resourceGroupName, serverName, databaseName).get();
if (response.getStatus() == OperationStatus.Succeeded) {
return response;
}
DatabaseCreateOrUpdateResponse result = client2.getDatabaseActivationOperations().getDatabaseActivationOperationStatusAsync(response.getOperationStatusLink()).get();
int delayInSeconds = response.getRetryAfter();
if (delayInSeconds == 0) {
delayInSeconds = 30;
}
if (client2.getLongRunningOperationInitialTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationInitialTimeout();
}
while (result.getStatus() != null && result.getStatus().equals(OperationStatus.InProgress)) {
Thread.sleep(delayInSeconds * 1000);
result = client2.getDatabaseActivationOperations().getDatabaseActivationOperationStatusAsync(response.getOperationStatusLink()).get();
delayInSeconds = result.getRetryAfter();
if (delayInSeconds == 0) {
delayInSeconds = 15;
}
if (client2.getLongRunningOperationRetryTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationRetryTimeout();
}
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (client2 != null && shouldTrace) {
client2.close();
}
}
}
/**
* Start an Azure SQL Data Warehouse database resume operation.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to resume.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public Future resumeAsync(final String resourceGroupName, final String serverName, final String databaseName) {
return this.getClient().getExecutorService().submit(new Callable() {
@Override
public DatabaseCreateOrUpdateResponse call() throws Exception {
return resume(resourceGroupName, serverName, databaseName);
}
});
}
/**
* Start an Azure SQL Data Warehouse database resume operation.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the Azure SQL Server belongs.
* @param serverName Required. The name of the Azure SQL Server on which the
* data warehouse database is hosted.
* @param databaseName Required. The name of the Azure SQL Data Warehouse
* database to resume.
* @throws InterruptedException Thrown when a thread is waiting, sleeping,
* or otherwise occupied, and the thread is interrupted, either before or
* during the activity. Occasionally a method may wish to test whether the
* current thread has been interrupted, and if so, to immediately throw
* this exception. The following code can be used to achieve this effect:
* @throws ExecutionException Thrown when attempting to retrieve the result
* of a task that aborted by throwing an exception. This exception can be
* inspected using the Throwable.getCause() method.
* @throws IOException Thrown if there was an error setting up tracing for
* the request.
* @return Response for long running Azure Sql Database operations.
*/
@Override
public DatabaseCreateOrUpdateResponse resume(String resourceGroupName, String serverName, String databaseName) throws InterruptedException, ExecutionException, IOException {
SqlManagementClient client2 = this.getClient();
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap tracingParameters = new HashMap();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("serverName", serverName);
tracingParameters.put("databaseName", databaseName);
CloudTracing.enter(invocationId, this, "resumeAsync", tracingParameters);
}
try {
if (shouldTrace) {
client2 = this.getClient().withRequestFilterLast(new ClientRequestTrackingHandler(invocationId)).withResponseFilterLast(new ClientRequestTrackingHandler(invocationId));
}
DatabaseCreateOrUpdateResponse response = client2.getDatabaseActivationOperations().beginResumeAsync(resourceGroupName, serverName, databaseName).get();
if (response.getStatus() == OperationStatus.Succeeded) {
return response;
}
DatabaseCreateOrUpdateResponse result = client2.getDatabaseActivationOperations().getDatabaseActivationOperationStatusAsync(response.getOperationStatusLink()).get();
int delayInSeconds = response.getRetryAfter();
if (delayInSeconds == 0) {
delayInSeconds = 30;
}
if (client2.getLongRunningOperationInitialTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationInitialTimeout();
}
while (result.getStatus() != null && result.getStatus().equals(OperationStatus.InProgress)) {
Thread.sleep(delayInSeconds * 1000);
result = client2.getDatabaseActivationOperations().getDatabaseActivationOperationStatusAsync(response.getOperationStatusLink()).get();
delayInSeconds = result.getRetryAfter();
if (delayInSeconds == 0) {
delayInSeconds = 15;
}
if (client2.getLongRunningOperationRetryTimeout() >= 0) {
delayInSeconds = client2.getLongRunningOperationRetryTimeout();
}
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (client2 != null && shouldTrace) {
client2.close();
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy