com.azure.resourcemanager.sql.fluent.models.RestorableDroppedDatabaseInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-sql Show documentation
Show all versions of azure-resourcemanager-sql Show documentation
This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.sql.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.sql.models.BackupStorageRedundancy;
import com.azure.resourcemanager.sql.models.Sku;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.Map;
/**
* A restorable dropped database resource.
*/
@Fluent
public final class RestorableDroppedDatabaseInner extends ProxyResource {
/*
* The name and tier of the SKU.
*/
private Sku sku;
/*
* Resource location.
*/
private String location;
/*
* Resource tags.
*/
private Map tags;
/*
* Resource properties.
*/
private RestorableDroppedDatabaseProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of RestorableDroppedDatabaseInner class.
*/
public RestorableDroppedDatabaseInner() {
}
/**
* Get the sku property: The name and tier of the SKU.
*
* @return the sku value.
*/
public Sku sku() {
return this.sku;
}
/**
* Set the sku property: The name and tier of the SKU.
*
* @param sku the sku value to set.
* @return the RestorableDroppedDatabaseInner object itself.
*/
public RestorableDroppedDatabaseInner withSku(Sku sku) {
this.sku = sku;
return this;
}
/**
* Get the location property: Resource location.
*
* @return the location value.
*/
public String location() {
return this.location;
}
/**
* Set the location property: Resource location.
*
* @param location the location value to set.
* @return the RestorableDroppedDatabaseInner object itself.
*/
public RestorableDroppedDatabaseInner withLocation(String location) {
this.location = location;
return this;
}
/**
* Get the tags property: Resource tags.
*
* @return the tags value.
*/
public Map tags() {
return this.tags;
}
/**
* Set the tags property: Resource tags.
*
* @param tags the tags value to set.
* @return the RestorableDroppedDatabaseInner object itself.
*/
public RestorableDroppedDatabaseInner withTags(Map tags) {
this.tags = tags;
return this;
}
/**
* Get the innerProperties property: Resource properties.
*
* @return the innerProperties value.
*/
private RestorableDroppedDatabaseProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the databaseName property: The name of the database.
*
* @return the databaseName value.
*/
public String databaseName() {
return this.innerProperties() == null ? null : this.innerProperties().databaseName();
}
/**
* Get the maxSizeBytes property: The max size of the database expressed in bytes.
*
* @return the maxSizeBytes value.
*/
public Long maxSizeBytes() {
return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes();
}
/**
* Get the creationDate property: The creation date of the database (ISO8601 format).
*
* @return the creationDate value.
*/
public OffsetDateTime creationDate() {
return this.innerProperties() == null ? null : this.innerProperties().creationDate();
}
/**
* Get the deletionDate property: The deletion date of the database (ISO8601 format).
*
* @return the deletionDate value.
*/
public OffsetDateTime deletionDate() {
return this.innerProperties() == null ? null : this.innerProperties().deletionDate();
}
/**
* Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format).
*
* @return the earliestRestoreDate value.
*/
public OffsetDateTime earliestRestoreDate() {
return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate();
}
/**
* Get the backupStorageRedundancy property: The storage account type used to store backups for this database.
*
* @return the backupStorageRedundancy value.
*/
public BackupStorageRedundancy backupStorageRedundancy() {
return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (sku() != null) {
sku().validate();
}
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("sku", this.sku);
jsonWriter.writeStringField("location", this.location);
jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RestorableDroppedDatabaseInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RestorableDroppedDatabaseInner if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the RestorableDroppedDatabaseInner.
*/
public static RestorableDroppedDatabaseInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RestorableDroppedDatabaseInner deserializedRestorableDroppedDatabaseInner
= new RestorableDroppedDatabaseInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.type = reader.getString();
} else if ("sku".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.sku = Sku.fromJson(reader);
} else if ("location".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.location = reader.getString();
} else if ("tags".equals(fieldName)) {
Map tags = reader.readMap(reader1 -> reader1.getString());
deserializedRestorableDroppedDatabaseInner.tags = tags;
} else if ("properties".equals(fieldName)) {
deserializedRestorableDroppedDatabaseInner.innerProperties
= RestorableDroppedDatabaseProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedRestorableDroppedDatabaseInner;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy