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

com.azure.resourcemanager.webpubsub.fluent.models.SharedPrivateLinkResourceProperties 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.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 com.azure.resourcemanager.webpubsub.models.ProvisioningState;
import com.azure.resourcemanager.webpubsub.models.SharedPrivateLinkResourceStatus;
import java.io.IOException;

/**
 * Describes the properties of an existing Shared Private Link Resource.
 */
@Fluent
public final class SharedPrivateLinkResourceProperties
    implements JsonSerializable {
    /*
     * The group id from the provider of resource the shared private link resource is for
     */
    private String groupId;

    /*
     * The resource id of the resource the shared private link resource is for
     */
    private String privateLinkResourceId;

    /*
     * Provisioning state of the resource.
     */
    private ProvisioningState provisioningState;

    /*
     * The request message for requesting approval of the shared private link resource
     */
    private String requestMessage;

    /*
     * Status of the shared private link resource
     */
    private SharedPrivateLinkResourceStatus status;

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

    /**
     * Get the groupId property: The group id from the provider of resource the shared private link resource is for.
     * 
     * @return the groupId value.
     */
    public String groupId() {
        return this.groupId;
    }

    /**
     * Set the groupId property: The group id from the provider of resource the shared private link resource is for.
     * 
     * @param groupId the groupId value to set.
     * @return the SharedPrivateLinkResourceProperties object itself.
     */
    public SharedPrivateLinkResourceProperties withGroupId(String groupId) {
        this.groupId = groupId;
        return this;
    }

    /**
     * Get the privateLinkResourceId property: The resource id of the resource the shared private link resource is for.
     * 
     * @return the privateLinkResourceId value.
     */
    public String privateLinkResourceId() {
        return this.privateLinkResourceId;
    }

    /**
     * Set the privateLinkResourceId property: The resource id of the resource the shared private link resource is for.
     * 
     * @param privateLinkResourceId the privateLinkResourceId value to set.
     * @return the SharedPrivateLinkResourceProperties object itself.
     */
    public SharedPrivateLinkResourceProperties withPrivateLinkResourceId(String privateLinkResourceId) {
        this.privateLinkResourceId = privateLinkResourceId;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the requestMessage property: The request message for requesting approval of the shared private link resource.
     * 
     * @return the requestMessage value.
     */
    public String requestMessage() {
        return this.requestMessage;
    }

    /**
     * Set the requestMessage property: The request message for requesting approval of the shared private link resource.
     * 
     * @param requestMessage the requestMessage value to set.
     * @return the SharedPrivateLinkResourceProperties object itself.
     */
    public SharedPrivateLinkResourceProperties withRequestMessage(String requestMessage) {
        this.requestMessage = requestMessage;
        return this;
    }

    /**
     * Get the status property: Status of the shared private link resource.
     * 
     * @return the status value.
     */
    public SharedPrivateLinkResourceStatus status() {
        return this.status;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("groupId", this.groupId);
        jsonWriter.writeStringField("privateLinkResourceId", this.privateLinkResourceId);
        jsonWriter.writeStringField("requestMessage", this.requestMessage);
        return jsonWriter.writeEndObject();
    }

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

                if ("groupId".equals(fieldName)) {
                    deserializedSharedPrivateLinkResourceProperties.groupId = reader.getString();
                } else if ("privateLinkResourceId".equals(fieldName)) {
                    deserializedSharedPrivateLinkResourceProperties.privateLinkResourceId = reader.getString();
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedSharedPrivateLinkResourceProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("requestMessage".equals(fieldName)) {
                    deserializedSharedPrivateLinkResourceProperties.requestMessage = reader.getString();
                } else if ("status".equals(fieldName)) {
                    deserializedSharedPrivateLinkResourceProperties.status
                        = SharedPrivateLinkResourceStatus.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSharedPrivateLinkResourceProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy