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;
        }
Exemplo n.º 2
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();
 }
        internal static SloUsageMetric DeserializeSloUsageMetric(JsonElement element)
        {
            Optional <ServiceObjectiveName> serviceLevelObjective = default;
            Optional <Guid>   serviceLevelObjectiveId             = default;
            Optional <double> inRangeTimeRatio = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("serviceLevelObjective"))
                {
                    serviceLevelObjective = new ServiceObjectiveName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("serviceLevelObjectiveId"))
                {
                    serviceLevelObjectiveId = property.Value.GetGuid();
                    continue;
                }
                if (property.NameEquals("inRangeTimeRatio"))
                {
                    inRangeTimeRatio = property.Value.GetDouble();
                    continue;
                }
            }
            return(new SloUsageMetric(Optional.ToNullable(serviceLevelObjective), Optional.ToNullable(serviceLevelObjectiveId), Optional.ToNullable(inRangeTimeRatio)));
        }