public AzureSqlSyncGroupSchemaModel(SyncGroupSchema schema)
 {
     if (schema.Tables != null)
     {
         Tables = new List <AzureSqlSyncGroupSchemaTableModel>();
         foreach (var table in schema.Tables)
         {
             Tables.Add(new AzureSqlSyncGroupSchemaTableModel(table));
         }
     }
     MasterSyncMemberName = schema.MasterSyncMemberName;
 }
Esempio n. 2
0
 internal SyncGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SqlSku sku, int?interval, DateTimeOffset?lastSyncOn, SyncConflictResolutionPolicy?conflictResolutionPolicy, string syncDatabaseId, string hubDatabaseUserName, string hubDatabasePassword, SyncGroupState?syncState, SyncGroupSchema schema, bool?enableConflictLogging, int?conflictLoggingRetentionInDays, bool?usePrivateLinkConnection, string privateEndpointName) : base(id, name, resourceType, systemData)
 {
     Sku        = sku;
     Interval   = interval;
     LastSyncOn = lastSyncOn;
     ConflictResolutionPolicy = conflictResolutionPolicy;
     SyncDatabaseId           = syncDatabaseId;
     HubDatabaseUserName      = hubDatabaseUserName;
     HubDatabasePassword      = hubDatabasePassword;
     SyncState                      = syncState;
     Schema                         = schema;
     EnableConflictLogging          = enableConflictLogging;
     ConflictLoggingRetentionInDays = conflictLoggingRetentionInDays;
     UsePrivateLinkConnection       = usePrivateLinkConnection;
     PrivateEndpointName            = privateEndpointName;
 }
 /// <summary>
 /// Sets the schema.
 /// </summary>
 /// <param name="schema">The schema object to set.</param>
 /// <return>The next stage of the definition.</return>
 SqlSyncGroup.Update.IUpdate SqlSyncGroup.Update.IWithSchema.WithSchema(SyncGroupSchema schema)
 {
     return(this.WithSchema(schema));
 }
 /// <summary>
 /// Sets the schema.
 /// </summary>
 /// <param name="schema">The schema object to set.</param>
 /// <return>The next stage of the definition.</return>
 SqlSyncGroupOperations.Definition.IWithCreate SqlSyncGroupOperations.Definition.IWithSchema.WithSchema(SyncGroupSchema schema)
 {
     return(this.WithSchema(schema));
 }
Esempio n. 5
0
        internal static SyncGroupData DeserializeSyncGroupData(JsonElement element)
        {
            Optional <SqlSku>         sku          = default;
            ResourceIdentifier        id           = default;
            string                    name         = default;
            ResourceType              type         = default;
            SystemData                systemData   = default;
            Optional <int>            interval     = default;
            Optional <DateTimeOffset> lastSyncTime = default;
            Optional <SyncConflictResolutionPolicy> conflictResolutionPolicy = default;
            Optional <string>          syncDatabaseId      = default;
            Optional <string>          hubDatabaseUserName = default;
            Optional <string>          hubDatabasePassword = default;
            Optional <SyncGroupState>  syncState           = default;
            Optional <SyncGroupSchema> schema = default;
            Optional <bool>            enableConflictLogging          = default;
            Optional <int>             conflictLoggingRetentionInDays = default;
            Optional <bool>            usePrivateLinkConnection       = default;
            Optional <string>          privateEndpointName            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = SqlSku.DeserializeSqlSku(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("interval"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            interval = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("lastSyncTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastSyncTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("conflictResolutionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            conflictResolutionPolicy = new SyncConflictResolutionPolicy(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("syncDatabaseId"))
                        {
                            syncDatabaseId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hubDatabaseUserName"))
                        {
                            hubDatabaseUserName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hubDatabasePassword"))
                        {
                            hubDatabasePassword = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("syncState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            syncState = new SyncGroupState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("schema"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            schema = SyncGroupSchema.DeserializeSyncGroupSchema(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enableConflictLogging"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableConflictLogging = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("conflictLoggingRetentionInDays"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            conflictLoggingRetentionInDays = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("usePrivateLinkConnection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            usePrivateLinkConnection = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointName"))
                        {
                            privateEndpointName = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SyncGroupData(id, name, type, systemData, sku.Value, Optional.ToNullable(interval), Optional.ToNullable(lastSyncTime), Optional.ToNullable(conflictResolutionPolicy), syncDatabaseId.Value, hubDatabaseUserName.Value, hubDatabasePassword.Value, Optional.ToNullable(syncState), schema.Value, Optional.ToNullable(enableConflictLogging), Optional.ToNullable(conflictLoggingRetentionInDays), Optional.ToNullable(usePrivateLinkConnection), privateEndpointName.Value));
        }
Esempio n. 6
0
 ///GENMHASH:C842205CEEB1B7840FA37E184CA45707:B5B203221698B5E13EC510A3D1B834EC
 public SqlSyncGroupImpl WithSchema(SyncGroupSchema schema)
 {
     this.Inner.Schema = schema;
     return(this);
 }