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

com.azure.resourcemanager.sql.fluent.models.DistributedAvailabilityGroupInner Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

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.sql.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.sql.models.ReplicationMode;
import java.io.IOException;
import java.util.UUID;

/**
 * Distributed availability group between box and Sql Managed Instance.
 */
@Fluent
public final class DistributedAvailabilityGroupInner extends ProxyResource {
    /*
     * Resource properties.
     */
    private DistributedAvailabilityGroupProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Resource properties.
     * 
     * @return the innerProperties value.
     */
    private DistributedAvailabilityGroupProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the targetDatabase property: The name of the target database.
     * 
     * @return the targetDatabase value.
     */
    public String targetDatabase() {
        return this.innerProperties() == null ? null : this.innerProperties().targetDatabase();
    }

    /**
     * Set the targetDatabase property: The name of the target database.
     * 
     * @param targetDatabase the targetDatabase value to set.
     * @return the DistributedAvailabilityGroupInner object itself.
     */
    public DistributedAvailabilityGroupInner withTargetDatabase(String targetDatabase) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DistributedAvailabilityGroupProperties();
        }
        this.innerProperties().withTargetDatabase(targetDatabase);
        return this;
    }

    /**
     * Get the sourceEndpoint property: The source endpoint.
     * 
     * @return the sourceEndpoint value.
     */
    public String sourceEndpoint() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceEndpoint();
    }

    /**
     * Set the sourceEndpoint property: The source endpoint.
     * 
     * @param sourceEndpoint the sourceEndpoint value to set.
     * @return the DistributedAvailabilityGroupInner object itself.
     */
    public DistributedAvailabilityGroupInner withSourceEndpoint(String sourceEndpoint) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DistributedAvailabilityGroupProperties();
        }
        this.innerProperties().withSourceEndpoint(sourceEndpoint);
        return this;
    }

    /**
     * Get the primaryAvailabilityGroupName property: The primary availability group name.
     * 
     * @return the primaryAvailabilityGroupName value.
     */
    public String primaryAvailabilityGroupName() {
        return this.innerProperties() == null ? null : this.innerProperties().primaryAvailabilityGroupName();
    }

    /**
     * Set the primaryAvailabilityGroupName property: The primary availability group name.
     * 
     * @param primaryAvailabilityGroupName the primaryAvailabilityGroupName value to set.
     * @return the DistributedAvailabilityGroupInner object itself.
     */
    public DistributedAvailabilityGroupInner withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DistributedAvailabilityGroupProperties();
        }
        this.innerProperties().withPrimaryAvailabilityGroupName(primaryAvailabilityGroupName);
        return this;
    }

    /**
     * Get the secondaryAvailabilityGroupName property: The secondary availability group name.
     * 
     * @return the secondaryAvailabilityGroupName value.
     */
    public String secondaryAvailabilityGroupName() {
        return this.innerProperties() == null ? null : this.innerProperties().secondaryAvailabilityGroupName();
    }

    /**
     * Set the secondaryAvailabilityGroupName property: The secondary availability group name.
     * 
     * @param secondaryAvailabilityGroupName the secondaryAvailabilityGroupName value to set.
     * @return the DistributedAvailabilityGroupInner object itself.
     */
    public DistributedAvailabilityGroupInner withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DistributedAvailabilityGroupProperties();
        }
        this.innerProperties().withSecondaryAvailabilityGroupName(secondaryAvailabilityGroupName);
        return this;
    }

    /**
     * Get the replicationMode property: The replication mode of a distributed availability group. Parameter will be
     * ignored during link creation.
     * 
     * @return the replicationMode value.
     */
    public ReplicationMode replicationMode() {
        return this.innerProperties() == null ? null : this.innerProperties().replicationMode();
    }

    /**
     * Set the replicationMode property: The replication mode of a distributed availability group. Parameter will be
     * ignored during link creation.
     * 
     * @param replicationMode the replicationMode value to set.
     * @return the DistributedAvailabilityGroupInner object itself.
     */
    public DistributedAvailabilityGroupInner withReplicationMode(ReplicationMode replicationMode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DistributedAvailabilityGroupProperties();
        }
        this.innerProperties().withReplicationMode(replicationMode);
        return this;
    }

    /**
     * Get the distributedAvailabilityGroupId property: The distributed availability group id.
     * 
     * @return the distributedAvailabilityGroupId value.
     */
    public UUID distributedAvailabilityGroupId() {
        return this.innerProperties() == null ? null : this.innerProperties().distributedAvailabilityGroupId();
    }

    /**
     * Get the sourceReplicaId property: The source replica id.
     * 
     * @return the sourceReplicaId value.
     */
    public UUID sourceReplicaId() {
        return this.innerProperties() == null ? null : this.innerProperties().sourceReplicaId();
    }

    /**
     * Get the targetReplicaId property: The target replica id.
     * 
     * @return the targetReplicaId value.
     */
    public UUID targetReplicaId() {
        return this.innerProperties() == null ? null : this.innerProperties().targetReplicaId();
    }

    /**
     * Get the linkState property: The link state.
     * 
     * @return the linkState value.
     */
    public String linkState() {
        return this.innerProperties() == null ? null : this.innerProperties().linkState();
    }

    /**
     * Get the lastHardenedLsn property: The last hardened lsn.
     * 
     * @return the lastHardenedLsn value.
     */
    public String lastHardenedLsn() {
        return this.innerProperties() == null ? null : this.innerProperties().lastHardenedLsn();
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedDistributedAvailabilityGroupInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedDistributedAvailabilityGroupInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedDistributedAvailabilityGroupInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedDistributedAvailabilityGroupInner.innerProperties
                        = DistributedAvailabilityGroupProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDistributedAvailabilityGroupInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy