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

com.azure.resourcemanager.sql.fluent.models.SyncGroupProperties 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.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.sql.models.SyncConflictResolutionPolicy;
import com.azure.resourcemanager.sql.models.SyncGroupSchema;
import com.azure.resourcemanager.sql.models.SyncGroupState;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Properties of a sync group.
 */
@Fluent
public final class SyncGroupProperties implements JsonSerializable {
    /*
     * Sync interval of the sync group.
     */
    private Integer interval;

    /*
     * Last sync time of the sync group.
     */
    private OffsetDateTime lastSyncTime;

    /*
     * Conflict resolution policy of the sync group.
     */
    private SyncConflictResolutionPolicy conflictResolutionPolicy;

    /*
     * ARM resource id of the sync database in the sync group.
     */
    private String syncDatabaseId;

    /*
     * User name for the sync group hub database credential.
     */
    private String hubDatabaseUsername;

    /*
     * Password for the sync group hub database credential.
     */
    private String hubDatabasePassword;

    /*
     * Sync state of the sync group.
     */
    private SyncGroupState syncState;

    /*
     * Sync schema of the sync group.
     */
    private SyncGroupSchema schema;

    /*
     * If conflict logging is enabled.
     */
    private Boolean enableConflictLogging;

    /*
     * Conflict logging retention period.
     */
    private Integer conflictLoggingRetentionInDays;

    /*
     * If use private link connection is enabled.
     */
    private Boolean usePrivateLinkConnection;

    /*
     * Private endpoint name of the sync group if use private link connection is enabled.
     */
    private String privateEndpointName;

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

    /**
     * Get the interval property: Sync interval of the sync group.
     * 
     * @return the interval value.
     */
    public Integer interval() {
        return this.interval;
    }

    /**
     * Set the interval property: Sync interval of the sync group.
     * 
     * @param interval the interval value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withInterval(Integer interval) {
        this.interval = interval;
        return this;
    }

    /**
     * Get the lastSyncTime property: Last sync time of the sync group.
     * 
     * @return the lastSyncTime value.
     */
    public OffsetDateTime lastSyncTime() {
        return this.lastSyncTime;
    }

    /**
     * Get the conflictResolutionPolicy property: Conflict resolution policy of the sync group.
     * 
     * @return the conflictResolutionPolicy value.
     */
    public SyncConflictResolutionPolicy conflictResolutionPolicy() {
        return this.conflictResolutionPolicy;
    }

    /**
     * Set the conflictResolutionPolicy property: Conflict resolution policy of the sync group.
     * 
     * @param conflictResolutionPolicy the conflictResolutionPolicy value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) {
        this.conflictResolutionPolicy = conflictResolutionPolicy;
        return this;
    }

    /**
     * Get the syncDatabaseId property: ARM resource id of the sync database in the sync group.
     * 
     * @return the syncDatabaseId value.
     */
    public String syncDatabaseId() {
        return this.syncDatabaseId;
    }

    /**
     * Set the syncDatabaseId property: ARM resource id of the sync database in the sync group.
     * 
     * @param syncDatabaseId the syncDatabaseId value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withSyncDatabaseId(String syncDatabaseId) {
        this.syncDatabaseId = syncDatabaseId;
        return this;
    }

    /**
     * Get the hubDatabaseUsername property: User name for the sync group hub database credential.
     * 
     * @return the hubDatabaseUsername value.
     */
    public String hubDatabaseUsername() {
        return this.hubDatabaseUsername;
    }

    /**
     * Set the hubDatabaseUsername property: User name for the sync group hub database credential.
     * 
     * @param hubDatabaseUsername the hubDatabaseUsername value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withHubDatabaseUsername(String hubDatabaseUsername) {
        this.hubDatabaseUsername = hubDatabaseUsername;
        return this;
    }

    /**
     * Get the hubDatabasePassword property: Password for the sync group hub database credential.
     * 
     * @return the hubDatabasePassword value.
     */
    public String hubDatabasePassword() {
        return this.hubDatabasePassword;
    }

    /**
     * Set the hubDatabasePassword property: Password for the sync group hub database credential.
     * 
     * @param hubDatabasePassword the hubDatabasePassword value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withHubDatabasePassword(String hubDatabasePassword) {
        this.hubDatabasePassword = hubDatabasePassword;
        return this;
    }

    /**
     * Get the syncState property: Sync state of the sync group.
     * 
     * @return the syncState value.
     */
    public SyncGroupState syncState() {
        return this.syncState;
    }

    /**
     * Get the schema property: Sync schema of the sync group.
     * 
     * @return the schema value.
     */
    public SyncGroupSchema schema() {
        return this.schema;
    }

    /**
     * Set the schema property: Sync schema of the sync group.
     * 
     * @param schema the schema value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withSchema(SyncGroupSchema schema) {
        this.schema = schema;
        return this;
    }

    /**
     * Get the enableConflictLogging property: If conflict logging is enabled.
     * 
     * @return the enableConflictLogging value.
     */
    public Boolean enableConflictLogging() {
        return this.enableConflictLogging;
    }

    /**
     * Set the enableConflictLogging property: If conflict logging is enabled.
     * 
     * @param enableConflictLogging the enableConflictLogging value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withEnableConflictLogging(Boolean enableConflictLogging) {
        this.enableConflictLogging = enableConflictLogging;
        return this;
    }

    /**
     * Get the conflictLoggingRetentionInDays property: Conflict logging retention period.
     * 
     * @return the conflictLoggingRetentionInDays value.
     */
    public Integer conflictLoggingRetentionInDays() {
        return this.conflictLoggingRetentionInDays;
    }

    /**
     * Set the conflictLoggingRetentionInDays property: Conflict logging retention period.
     * 
     * @param conflictLoggingRetentionInDays the conflictLoggingRetentionInDays value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) {
        this.conflictLoggingRetentionInDays = conflictLoggingRetentionInDays;
        return this;
    }

    /**
     * Get the usePrivateLinkConnection property: If use private link connection is enabled.
     * 
     * @return the usePrivateLinkConnection value.
     */
    public Boolean usePrivateLinkConnection() {
        return this.usePrivateLinkConnection;
    }

    /**
     * Set the usePrivateLinkConnection property: If use private link connection is enabled.
     * 
     * @param usePrivateLinkConnection the usePrivateLinkConnection value to set.
     * @return the SyncGroupProperties object itself.
     */
    public SyncGroupProperties withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) {
        this.usePrivateLinkConnection = usePrivateLinkConnection;
        return this;
    }

    /**
     * Get the privateEndpointName property: Private endpoint name of the sync group if use private link connection is
     * enabled.
     * 
     * @return the privateEndpointName value.
     */
    public String privateEndpointName() {
        return this.privateEndpointName;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("interval", this.interval);
        jsonWriter.writeStringField("conflictResolutionPolicy",
            this.conflictResolutionPolicy == null ? null : this.conflictResolutionPolicy.toString());
        jsonWriter.writeStringField("syncDatabaseId", this.syncDatabaseId);
        jsonWriter.writeStringField("hubDatabaseUserName", this.hubDatabaseUsername);
        jsonWriter.writeStringField("hubDatabasePassword", this.hubDatabasePassword);
        jsonWriter.writeJsonField("schema", this.schema);
        jsonWriter.writeBooleanField("enableConflictLogging", this.enableConflictLogging);
        jsonWriter.writeNumberField("conflictLoggingRetentionInDays", this.conflictLoggingRetentionInDays);
        jsonWriter.writeBooleanField("usePrivateLinkConnection", this.usePrivateLinkConnection);
        return jsonWriter.writeEndObject();
    }

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

                if ("interval".equals(fieldName)) {
                    deserializedSyncGroupProperties.interval = reader.getNullable(JsonReader::getInt);
                } else if ("lastSyncTime".equals(fieldName)) {
                    deserializedSyncGroupProperties.lastSyncTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("conflictResolutionPolicy".equals(fieldName)) {
                    deserializedSyncGroupProperties.conflictResolutionPolicy
                        = SyncConflictResolutionPolicy.fromString(reader.getString());
                } else if ("syncDatabaseId".equals(fieldName)) {
                    deserializedSyncGroupProperties.syncDatabaseId = reader.getString();
                } else if ("hubDatabaseUserName".equals(fieldName)) {
                    deserializedSyncGroupProperties.hubDatabaseUsername = reader.getString();
                } else if ("hubDatabasePassword".equals(fieldName)) {
                    deserializedSyncGroupProperties.hubDatabasePassword = reader.getString();
                } else if ("syncState".equals(fieldName)) {
                    deserializedSyncGroupProperties.syncState = SyncGroupState.fromString(reader.getString());
                } else if ("schema".equals(fieldName)) {
                    deserializedSyncGroupProperties.schema = SyncGroupSchema.fromJson(reader);
                } else if ("enableConflictLogging".equals(fieldName)) {
                    deserializedSyncGroupProperties.enableConflictLogging = reader.getNullable(JsonReader::getBoolean);
                } else if ("conflictLoggingRetentionInDays".equals(fieldName)) {
                    deserializedSyncGroupProperties.conflictLoggingRetentionInDays
                        = reader.getNullable(JsonReader::getInt);
                } else if ("usePrivateLinkConnection".equals(fieldName)) {
                    deserializedSyncGroupProperties.usePrivateLinkConnection
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("privateEndpointName".equals(fieldName)) {
                    deserializedSyncGroupProperties.privateEndpointName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSyncGroupProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy