com.azure.resourcemanager.mediaservices.models.MediaServiceIdentity 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;
import java.util.Map;
import java.util.UUID;
/**
* The MediaServiceIdentity model.
*/
@Fluent
public final class MediaServiceIdentity implements JsonSerializable {
/*
* The identity type.
*/
private String type;
/*
* The Principal ID of the identity.
*/
private UUID principalId;
/*
* The Tenant ID of the identity.
*/
private UUID tenantId;
/*
* The user assigned managed identities.
*/
private Map userAssignedIdentities;
/**
* Creates an instance of MediaServiceIdentity class.
*/
public MediaServiceIdentity() {
}
/**
* Get the type property: The identity type.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* Set the type property: The identity type.
*
* @param type the type value to set.
* @return the MediaServiceIdentity object itself.
*/
public MediaServiceIdentity withType(String type) {
this.type = type;
return this;
}
/**
* Get the principalId property: The Principal ID of the identity.
*
* @return the principalId value.
*/
public UUID principalId() {
return this.principalId;
}
/**
* Get the tenantId property: The Tenant ID of the identity.
*
* @return the tenantId value.
*/
public UUID tenantId() {
return this.tenantId;
}
/**
* Get the userAssignedIdentities property: The user assigned managed identities.
*
* @return the userAssignedIdentities value.
*/
public Map userAssignedIdentities() {
return this.userAssignedIdentities;
}
/**
* Set the userAssignedIdentities property: The user assigned managed identities.
*
* @param userAssignedIdentities the userAssignedIdentities value to set.
* @return the MediaServiceIdentity object itself.
*/
public MediaServiceIdentity
withUserAssignedIdentities(Map userAssignedIdentities) {
this.userAssignedIdentities = userAssignedIdentities;
return this;
}
/**
* 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 MediaServiceIdentity"));
}
if (userAssignedIdentities() != null) {
userAssignedIdentities().values().forEach(e -> {
if (e != null) {
e.validate();
}
});
}
}
private static final ClientLogger LOGGER = new ClientLogger(MediaServiceIdentity.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type);
jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MediaServiceIdentity from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MediaServiceIdentity 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 MediaServiceIdentity.
*/
public static MediaServiceIdentity fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MediaServiceIdentity deserializedMediaServiceIdentity = new MediaServiceIdentity();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedMediaServiceIdentity.type = reader.getString();
} else if ("principalId".equals(fieldName)) {
deserializedMediaServiceIdentity.principalId
= reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
} else if ("tenantId".equals(fieldName)) {
deserializedMediaServiceIdentity.tenantId
= reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
} else if ("userAssignedIdentities".equals(fieldName)) {
Map userAssignedIdentities
= reader.readMap(reader1 -> UserAssignedManagedIdentity.fromJson(reader1));
deserializedMediaServiceIdentity.userAssignedIdentities = userAssignedIdentities;
} else {
reader.skipChildren();
}
}
return deserializedMediaServiceIdentity;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy