コード例 #1
0
        internal static CloudServiceRole DeserializeCloudServiceRole(JsonElement element)
        {
            Optional <string> location = default;
            Optional <CloudServiceRoleSku>        sku        = default;
            Optional <CloudServiceRoleProperties> properties = default;
            ResourceIdentifier id   = default;
            string             name = default;
            ResourceType       type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = CloudServiceRoleSku.DeserializeCloudServiceRoleSku(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = CloudServiceRoleProperties.DeserializeCloudServiceRoleProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
            }
            return(new CloudServiceRole(id, name, type, location.Value, sku.Value, properties.Value));
        }
コード例 #2
0
 internal CloudServiceRole(ResourceIdentifier id, string name, ResourceType type, string location, CloudServiceRoleSku sku, CloudServiceRoleProperties properties) : base(id, name, type)
 {
     Location   = location;
     Sku        = sku;
     Properties = properties;
 }