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

com.azure.resourcemanager.appcontainers.models.SessionRegistryCredentials Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for ContainerAppsApi Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-03.

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.appcontainers.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;

/**
 * Session pool private registry credentials.
 */
@Fluent
public final class SessionRegistryCredentials implements JsonSerializable {
    /*
     * Container registry server.
     */
    private String server;

    /*
     * Container registry username.
     */
    private String username;

    /*
     * The name of the secret that contains the registry login password
     */
    private String passwordSecretRef;

    /*
     * A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the
     * full user-assigned identity Resource ID. For system-assigned identities, use 'system'
     */
    private String identity;

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

    /**
     * Get the server property: Container registry server.
     * 
     * @return the server value.
     */
    public String server() {
        return this.server;
    }

    /**
     * Set the server property: Container registry server.
     * 
     * @param server the server value to set.
     * @return the SessionRegistryCredentials object itself.
     */
    public SessionRegistryCredentials withServer(String server) {
        this.server = server;
        return this;
    }

    /**
     * Get the username property: Container registry username.
     * 
     * @return the username value.
     */
    public String username() {
        return this.username;
    }

    /**
     * Set the username property: Container registry username.
     * 
     * @param username the username value to set.
     * @return the SessionRegistryCredentials object itself.
     */
    public SessionRegistryCredentials withUsername(String username) {
        this.username = username;
        return this;
    }

    /**
     * Get the passwordSecretRef property: The name of the secret that contains the registry login password.
     * 
     * @return the passwordSecretRef value.
     */
    public String passwordSecretRef() {
        return this.passwordSecretRef;
    }

    /**
     * Set the passwordSecretRef property: The name of the secret that contains the registry login password.
     * 
     * @param passwordSecretRef the passwordSecretRef value to set.
     * @return the SessionRegistryCredentials object itself.
     */
    public SessionRegistryCredentials withPasswordSecretRef(String passwordSecretRef) {
        this.passwordSecretRef = passwordSecretRef;
        return this;
    }

    /**
     * Get the identity property: A Managed Identity to use to authenticate with Azure Container Registry. For
     * user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned identities, use
     * 'system'.
     * 
     * @return the identity value.
     */
    public String identity() {
        return this.identity;
    }

    /**
     * Set the identity property: A Managed Identity to use to authenticate with Azure Container Registry. For
     * user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned identities, use
     * 'system'.
     * 
     * @param identity the identity value to set.
     * @return the SessionRegistryCredentials object itself.
     */
    public SessionRegistryCredentials withIdentity(String identity) {
        this.identity = identity;
        return this;
    }

    /**
     * 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();
        jsonWriter.writeStringField("server", this.server);
        jsonWriter.writeStringField("username", this.username);
        jsonWriter.writeStringField("passwordSecretRef", this.passwordSecretRef);
        jsonWriter.writeStringField("identity", this.identity);
        return jsonWriter.writeEndObject();
    }

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

                if ("server".equals(fieldName)) {
                    deserializedSessionRegistryCredentials.server = reader.getString();
                } else if ("username".equals(fieldName)) {
                    deserializedSessionRegistryCredentials.username = reader.getString();
                } else if ("passwordSecretRef".equals(fieldName)) {
                    deserializedSessionRegistryCredentials.passwordSecretRef = reader.getString();
                } else if ("identity".equals(fieldName)) {
                    deserializedSessionRegistryCredentials.identity = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSessionRegistryCredentials;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy