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

com.azure.ai.metricsadvisor.implementation.models.ServicePrincipalParam Maven / Gradle / Ivy

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.ai.metricsadvisor.implementation.models;

import com.azure.core.annotation.Fluent;
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 ServicePrincipalParam model.
 */
@Fluent
public final class ServicePrincipalParam implements JsonSerializable {
    /*
     * The client id of the service principal.
     */
    private String clientId;

    /*
     * The client secret of the service principal.
     */
    private String clientSecret;

    /*
     * The tenant id of the service principal.
     */
    private String tenantId;

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

    /**
     * Get the clientId property: The client id of the service principal.
     * 
     * @return the clientId value.
     */
    public String getClientId() {
        return this.clientId;
    }

    /**
     * Set the clientId property: The client id of the service principal.
     * 
     * @param clientId the clientId value to set.
     * @return the ServicePrincipalParam object itself.
     */
    public ServicePrincipalParam setClientId(String clientId) {
        this.clientId = clientId;
        return this;
    }

    /**
     * Get the clientSecret property: The client secret of the service principal.
     * 
     * @return the clientSecret value.
     */
    public String getClientSecret() {
        return this.clientSecret;
    }

    /**
     * Set the clientSecret property: The client secret of the service principal.
     * 
     * @param clientSecret the clientSecret value to set.
     * @return the ServicePrincipalParam object itself.
     */
    public ServicePrincipalParam setClientSecret(String clientSecret) {
        this.clientSecret = clientSecret;
        return this;
    }

    /**
     * Get the tenantId property: The tenant id of the service principal.
     * 
     * @return the tenantId value.
     */
    public String getTenantId() {
        return this.tenantId;
    }

    /**
     * Set the tenantId property: The tenant id of the service principal.
     * 
     * @param tenantId the tenantId value to set.
     * @return the ServicePrincipalParam object itself.
     */
    public ServicePrincipalParam setTenantId(String tenantId) {
        this.tenantId = tenantId;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("clientId", this.clientId);
        jsonWriter.writeStringField("tenantId", this.tenantId);
        jsonWriter.writeStringField("clientSecret", this.clientSecret);
        return jsonWriter.writeEndObject();
    }

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

                if ("clientId".equals(fieldName)) {
                    deserializedServicePrincipalParam.clientId = reader.getString();
                } else if ("tenantId".equals(fieldName)) {
                    deserializedServicePrincipalParam.tenantId = reader.getString();
                } else if ("clientSecret".equals(fieldName)) {
                    deserializedServicePrincipalParam.clientSecret = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedServicePrincipalParam;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy