com.azure.resourcemanager.automation.models.Key Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-automation Show documentation
Show all versions of azure-resourcemanager-automation Show documentation
This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.
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.automation.models;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Automation key which is used to register a DSC Node.
*/
@Immutable
public final class Key implements JsonSerializable {
/*
* Automation key name.
*/
private AutomationKeyName keyName;
/*
* Automation key permissions.
*/
private AutomationKeyPermissions permissions;
/*
* Value of the Automation Key used for registration.
*/
private String value;
/**
* Creates an instance of Key class.
*/
public Key() {
}
/**
* Get the keyName property: Automation key name.
*
* @return the keyName value.
*/
public AutomationKeyName keyName() {
return this.keyName;
}
/**
* Get the permissions property: Automation key permissions.
*
* @return the permissions value.
*/
public AutomationKeyPermissions permissions() {
return this.permissions;
}
/**
* Get the value property: Value of the Automation Key used for registration.
*
* @return the value value.
*/
public String value() {
return this.value;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Key from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Key if the JsonReader was pointing to an instance of it, or null if it was pointing to
* JSON null.
* @throws IOException If an error occurs while reading the Key.
*/
public static Key fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Key deserializedKey = new Key();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("KeyName".equals(fieldName)) {
deserializedKey.keyName = AutomationKeyName.fromString(reader.getString());
} else if ("Permissions".equals(fieldName)) {
deserializedKey.permissions = AutomationKeyPermissions.fromString(reader.getString());
} else if ("Value".equals(fieldName)) {
deserializedKey.value = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedKey;
});
}
}