Esempio n. 1
0
        public ImportExistingDatabaseDefinition(StorageKeyType storageKeyType, string storageKey, Uri storageUri, string administratorLogin, string administratorLoginPassword)
        {
            if (storageKey == null)
            {
                throw new ArgumentNullException(nameof(storageKey));
            }
            if (storageUri == null)
            {
                throw new ArgumentNullException(nameof(storageUri));
            }
            if (administratorLogin == null)
            {
                throw new ArgumentNullException(nameof(administratorLogin));
            }
            if (administratorLoginPassword == null)
            {
                throw new ArgumentNullException(nameof(administratorLoginPassword));
            }

            StorageKeyType             = storageKeyType;
            StorageKey                 = storageKey;
            StorageUri                 = storageUri;
            AdministratorLogin         = administratorLogin;
            AdministratorLoginPassword = administratorLoginPassword;
        }
        public ExportRequest(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword)
        {
            if (storageKey == null)
            {
                throw new ArgumentNullException(nameof(storageKey));
            }
            if (storageUri == null)
            {
                throw new ArgumentNullException(nameof(storageUri));
            }
            if (administratorLogin == null)
            {
                throw new ArgumentNullException(nameof(administratorLogin));
            }
            if (administratorLoginPassword == null)
            {
                throw new ArgumentNullException(nameof(administratorLoginPassword));
            }

            StorageKeyType             = storageKeyType;
            StorageKey                 = storageKey;
            StorageUri                 = storageUri;
            AdministratorLogin         = administratorLogin;
            AdministratorLoginPassword = administratorLoginPassword;
        }
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("storageKeyType");
     writer.WriteStringValue(StorageKeyType.ToString());
     writer.WritePropertyName("storageKey");
     writer.WriteStringValue(StorageKey);
     writer.WritePropertyName("storageUri");
     writer.WriteStringValue(StorageUri.AbsoluteUri);
     writer.WritePropertyName("administratorLogin");
     writer.WriteStringValue(AdministratorLogin);
     writer.WritePropertyName("administratorLoginPassword");
     writer.WriteStringValue(AdministratorLoginPassword);
     if (Optional.IsDefined(AuthenticationType))
     {
         writer.WritePropertyName("authenticationType");
         writer.WriteStringValue(AuthenticationType);
     }
     if (Optional.IsDefined(NetworkIsolation))
     {
         writer.WritePropertyName("networkIsolation");
         writer.WriteObjectValue(NetworkIsolation);
     }
     writer.WriteEndObject();
 }
Esempio n. 4
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("databaseName");
     writer.WriteStringValue(DatabaseName);
     writer.WritePropertyName("edition");
     writer.WriteStringValue(Edition.ToString());
     writer.WritePropertyName("serviceObjectiveName");
     writer.WriteStringValue(ServiceObjectiveName.ToString());
     writer.WritePropertyName("maxSizeBytes");
     writer.WriteStringValue(MaxSizeBytes);
     writer.WritePropertyName("storageKeyType");
     writer.WriteStringValue(StorageKeyType.ToSerialString());
     writer.WritePropertyName("storageKey");
     writer.WriteStringValue(StorageKey);
     writer.WritePropertyName("storageUri");
     writer.WriteStringValue(StorageUri);
     writer.WritePropertyName("administratorLogin");
     writer.WriteStringValue(AdministratorLogin);
     writer.WritePropertyName("administratorLoginPassword");
     writer.WriteStringValue(AdministratorLoginPassword);
     if (Optional.IsDefined(AuthenticationType))
     {
         writer.WritePropertyName("authenticationType");
         writer.WriteStringValue(AuthenticationType.Value.ToSerialString());
     }
     writer.WriteEndObject();
 }
        public ImportRequest(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword, string databaseName, DatabaseEdition edition, ServiceObjectiveName serviceObjectiveName, string maxSizeBytes) : base(storageKeyType, storageKey, storageUri, administratorLogin, administratorLoginPassword)
        {
            if (storageKey == null)
            {
                throw new ArgumentNullException(nameof(storageKey));
            }
            if (storageUri == null)
            {
                throw new ArgumentNullException(nameof(storageUri));
            }
            if (administratorLogin == null)
            {
                throw new ArgumentNullException(nameof(administratorLogin));
            }
            if (administratorLoginPassword == null)
            {
                throw new ArgumentNullException(nameof(administratorLoginPassword));
            }
            if (databaseName == null)
            {
                throw new ArgumentNullException(nameof(databaseName));
            }
            if (maxSizeBytes == null)
            {
                throw new ArgumentNullException(nameof(maxSizeBytes));
            }

            DatabaseName = databaseName;
            Edition = edition;
            ServiceObjectiveName = serviceObjectiveName;
            MaxSizeBytes = maxSizeBytes;
        }
        public ImportExtensionProperties(StorageKeyType storageKeyType, string storageKey, string storageUri, string administratorLogin, string administratorLoginPassword) : base(storageKeyType, storageKey, storageUri, administratorLogin, administratorLoginPassword)
        {
            if (storageKey == null)
            {
                throw new ArgumentNullException(nameof(storageKey));
            }
            if (storageUri == null)
            {
                throw new ArgumentNullException(nameof(storageUri));
            }
            if (administratorLogin == null)
            {
                throw new ArgumentNullException(nameof(administratorLogin));
            }
            if (administratorLoginPassword == null)
            {
                throw new ArgumentNullException(nameof(administratorLoginPassword));
            }

            OperationMode = "Import";
        }
Esempio n. 7
0
        internal static DatabaseExtensions DeserializeDatabaseExtensions(JsonElement element)
        {
            ResourceIdentifier        id             = default;
            string                    name           = default;
            ResourceType              type           = default;
            SystemData                systemData     = default;
            Optional <OperationMode>  operationMode  = default;
            Optional <StorageKeyType> storageKeyType = default;
            Optional <string>         storageKey     = default;
            Optional <Uri>            storageUri     = default;

            foreach (var property in element.EnumerateObject())
            {
                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 = 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("operationMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            operationMode = new OperationMode(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("storageKeyType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageKeyType = new StorageKeyType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("storageKey"))
                        {
                            storageKey = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("storageUri"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                storageUri = null;
                                continue;
                            }
                            storageUri = new Uri(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DatabaseExtensions(id, name, type, systemData, Optional.ToNullable(operationMode), Optional.ToNullable(storageKeyType), storageKey.Value, storageUri.Value));
        }
 public static string ToSerialString(this StorageKeyType value) => value switch
 {