All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.machinelearning.models.RegenerateEndpointKeysRequest Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.

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.machinelearning.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 RegenerateEndpointKeysRequest model.
 */
@Fluent
public final class RegenerateEndpointKeysRequest implements JsonSerializable {
    /*
     * [Required] Specification for which type of key to generate. Primary or Secondary.
     */
    private KeyType keyType;

    /*
     * The value the key is set to.
     */
    private String keyValue;

    /**
     * Creates an instance of RegenerateEndpointKeysRequest class.
     */
    public RegenerateEndpointKeysRequest() {
    }

    /**
     * Get the keyType property: [Required] Specification for which type of key to generate. Primary or Secondary.
     * 
     * @return the keyType value.
     */
    public KeyType keyType() {
        return this.keyType;
    }

    /**
     * Set the keyType property: [Required] Specification for which type of key to generate. Primary or Secondary.
     * 
     * @param keyType the keyType value to set.
     * @return the RegenerateEndpointKeysRequest object itself.
     */
    public RegenerateEndpointKeysRequest withKeyType(KeyType keyType) {
        this.keyType = keyType;
        return this;
    }

    /**
     * Get the keyValue property: The value the key is set to.
     * 
     * @return the keyValue value.
     */
    public String keyValue() {
        return this.keyValue;
    }

    /**
     * Set the keyValue property: The value the key is set to.
     * 
     * @param keyValue the keyValue value to set.
     * @return the RegenerateEndpointKeysRequest object itself.
     */
    public RegenerateEndpointKeysRequest withKeyValue(String keyValue) {
        this.keyValue = keyValue;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (keyType() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property keyType in model RegenerateEndpointKeysRequest"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(RegenerateEndpointKeysRequest.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("keyType", this.keyType == null ? null : this.keyType.toString());
        jsonWriter.writeStringField("keyValue", this.keyValue);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of RegenerateEndpointKeysRequest from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of RegenerateEndpointKeysRequest 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 RegenerateEndpointKeysRequest.
     */
    public static RegenerateEndpointKeysRequest fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            RegenerateEndpointKeysRequest deserializedRegenerateEndpointKeysRequest
                = new RegenerateEndpointKeysRequest();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("keyType".equals(fieldName)) {
                    deserializedRegenerateEndpointKeysRequest.keyType = KeyType.fromString(reader.getString());
                } else if ("keyValue".equals(fieldName)) {
                    deserializedRegenerateEndpointKeysRequest.keyValue = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRegenerateEndpointKeysRequest;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy