예제 #1
0
 internal BatchDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ManagedServiceIdentity identity, string kind, BatchDeploymentProperties properties, MachineLearningSku sku) : base(id, name, resourceType, systemData, tags, location)
 {
     Identity   = identity;
     Kind       = kind;
     Properties = properties;
     Sku        = sku;
 }
예제 #2
0
        public BatchDeploymentData(AzureLocation location, BatchDeploymentProperties properties) : base(location)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Properties = properties;
        }
예제 #3
0
        internal static BatchDeploymentData DeserializeBatchDeploymentData(JsonElement element)
        {
            Optional <ManagedServiceIdentity> identity = default;
            Optional <string>             kind         = default;
            BatchDeploymentProperties     properties   = default;
            Optional <MachineLearningSku> sku          = default;
            IDictionary <string, string>  tags         = default;
            AzureLocation      location   = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    var serializeOptions = new JsonSerializerOptions {
                        Converters = { new ManagedServiceIdentityTypeV3Converter() }
                    };
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString(), serializeOptions);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    properties = BatchDeploymentProperties.DeserializeBatchDeploymentProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = MachineLearningSku.DeserializeMachineLearningSku(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    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;
                }
            }
            return(new BatchDeploymentData(id, name, type, systemData, tags, location, identity, kind.Value, properties, sku.Value));
        }