com.azure.resourcemanager.mediaservices.models.StorageAccount Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mediaservices Show documentation
Show all versions of azure-resourcemanager-mediaservices Show documentation
This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.
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.mediaservices.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The storage account details.
*/
@Fluent
public final class StorageAccount implements JsonSerializable {
/*
* The ID of the storage account resource. Media Services relies on tables and queues as well as blobs, so the
* primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or
* Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts.
*/
private String id;
/*
* The type of the storage account.
*/
private StorageAccountType type;
/*
* The storage account identity.
*/
private ResourceIdentity identity;
/*
* The current status of the storage account mapping.
*/
private String status;
/**
* Creates an instance of StorageAccount class.
*/
public StorageAccount() {
}
/**
* Get the id property: The ID of the storage account resource. Media Services relies on tables and queues as well
* as blobs, so the primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or
* Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: The ID of the storage account resource. Media Services relies on tables and queues as well
* as blobs, so the primary storage account must be a Standard Storage account (either Microsoft.ClassicStorage or
* Microsoft.Storage). Blob only storage accounts can be added as secondary storage accounts.
*
* @param id the id value to set.
* @return the StorageAccount object itself.
*/
public StorageAccount withId(String id) {
this.id = id;
return this;
}
/**
* Get the type property: The type of the storage account.
*
* @return the type value.
*/
public StorageAccountType type() {
return this.type;
}
/**
* Set the type property: The type of the storage account.
*
* @param type the type value to set.
* @return the StorageAccount object itself.
*/
public StorageAccount withType(StorageAccountType type) {
this.type = type;
return this;
}
/**
* Get the identity property: The storage account identity.
*
* @return the identity value.
*/
public ResourceIdentity identity() {
return this.identity;
}
/**
* Set the identity property: The storage account identity.
*
* @param identity the identity value to set.
* @return the StorageAccount object itself.
*/
public StorageAccount withIdentity(ResourceIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the status property: The current status of the storage account mapping.
*
* @return the status value.
*/
public String status() {
return this.status;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (type() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property type in model StorageAccount"));
}
if (identity() != null) {
identity().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(StorageAccount.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeStringField("id", this.id);
jsonWriter.writeJsonField("identity", this.identity);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of StorageAccount from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of StorageAccount 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 StorageAccount.
*/
public static StorageAccount fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
StorageAccount deserializedStorageAccount = new StorageAccount();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedStorageAccount.type = StorageAccountType.fromString(reader.getString());
} else if ("id".equals(fieldName)) {
deserializedStorageAccount.id = reader.getString();
} else if ("identity".equals(fieldName)) {
deserializedStorageAccount.identity = ResourceIdentity.fromJson(reader);
} else if ("status".equals(fieldName)) {
deserializedStorageAccount.status = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedStorageAccount;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy