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

com.azure.resourcemanager.webpubsub.fluent.models.WebPubSubKeysInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2024-03-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.webpubsub.fluent.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;

/**
 * A class represents the access keys of the resource.
 */
@Fluent
public final class WebPubSubKeysInner implements JsonSerializable {
    /*
     * The primary access key.
     */
    private String primaryKey;

    /*
     * The secondary access key.
     */
    private String secondaryKey;

    /*
     * Connection string constructed via the primaryKey
     */
    private String primaryConnectionString;

    /*
     * Connection string constructed via the secondaryKey
     */
    private String secondaryConnectionString;

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

    /**
     * Get the primaryKey property: The primary access key.
     * 
     * @return the primaryKey value.
     */
    public String primaryKey() {
        return this.primaryKey;
    }

    /**
     * Set the primaryKey property: The primary access key.
     * 
     * @param primaryKey the primaryKey value to set.
     * @return the WebPubSubKeysInner object itself.
     */
    public WebPubSubKeysInner withPrimaryKey(String primaryKey) {
        this.primaryKey = primaryKey;
        return this;
    }

    /**
     * Get the secondaryKey property: The secondary access key.
     * 
     * @return the secondaryKey value.
     */
    public String secondaryKey() {
        return this.secondaryKey;
    }

    /**
     * Set the secondaryKey property: The secondary access key.
     * 
     * @param secondaryKey the secondaryKey value to set.
     * @return the WebPubSubKeysInner object itself.
     */
    public WebPubSubKeysInner withSecondaryKey(String secondaryKey) {
        this.secondaryKey = secondaryKey;
        return this;
    }

    /**
     * Get the primaryConnectionString property: Connection string constructed via the primaryKey.
     * 
     * @return the primaryConnectionString value.
     */
    public String primaryConnectionString() {
        return this.primaryConnectionString;
    }

    /**
     * Set the primaryConnectionString property: Connection string constructed via the primaryKey.
     * 
     * @param primaryConnectionString the primaryConnectionString value to set.
     * @return the WebPubSubKeysInner object itself.
     */
    public WebPubSubKeysInner withPrimaryConnectionString(String primaryConnectionString) {
        this.primaryConnectionString = primaryConnectionString;
        return this;
    }

    /**
     * Get the secondaryConnectionString property: Connection string constructed via the secondaryKey.
     * 
     * @return the secondaryConnectionString value.
     */
    public String secondaryConnectionString() {
        return this.secondaryConnectionString;
    }

    /**
     * Set the secondaryConnectionString property: Connection string constructed via the secondaryKey.
     * 
     * @param secondaryConnectionString the secondaryConnectionString value to set.
     * @return the WebPubSubKeysInner object itself.
     */
    public WebPubSubKeysInner withSecondaryConnectionString(String secondaryConnectionString) {
        this.secondaryConnectionString = secondaryConnectionString;
        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("primaryKey", this.primaryKey);
        jsonWriter.writeStringField("secondaryKey", this.secondaryKey);
        jsonWriter.writeStringField("primaryConnectionString", this.primaryConnectionString);
        jsonWriter.writeStringField("secondaryConnectionString", this.secondaryConnectionString);
        return jsonWriter.writeEndObject();
    }

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

                if ("primaryKey".equals(fieldName)) {
                    deserializedWebPubSubKeysInner.primaryKey = reader.getString();
                } else if ("secondaryKey".equals(fieldName)) {
                    deserializedWebPubSubKeysInner.secondaryKey = reader.getString();
                } else if ("primaryConnectionString".equals(fieldName)) {
                    deserializedWebPubSubKeysInner.primaryConnectionString = reader.getString();
                } else if ("secondaryConnectionString".equals(fieldName)) {
                    deserializedWebPubSubKeysInner.secondaryConnectionString = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWebPubSubKeysInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy