public VirtualApplicationGroupData(AzureLocation location, string hostPoolArmPath, ApplicationGroupType applicationGroupType) : base(location)
        {
            if (hostPoolArmPath == null)
            {
                throw new ArgumentNullException(nameof(hostPoolArmPath));
            }

            HostPoolArmPath      = hostPoolArmPath;
            ApplicationGroupType = applicationGroupType;
        }
 internal VirtualApplicationGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string managedBy, string kind, string etag, SystemAssignedServiceIdentity identity, ResourceModelWithAllowedPropertySetSku sku, ArmPlan plan, string objectId, string description, string friendlyName, string hostPoolArmPath, string workspaceArmPath, ApplicationGroupType applicationGroupType, MigrationRequestProperties migrationRequest, bool?cloudPcResource) : base(id, name, resourceType, systemData, tags, location, managedBy, kind, etag, identity, sku, plan)
 {
     ObjectId             = objectId;
     Description          = description;
     FriendlyName         = friendlyName;
     HostPoolArmPath      = hostPoolArmPath;
     WorkspaceArmPath     = workspaceArmPath;
     ApplicationGroupType = applicationGroupType;
     MigrationRequest     = migrationRequest;
     CloudPcResource      = cloudPcResource;
 }
예제 #3
0
        internal static VirtualApplicationGroupData DeserializeVirtualApplicationGroupData(JsonElement element)
        {
            Optional <string> managedBy = default;
            Optional <string> kind      = default;
            Optional <string> etag      = default;
            Optional <SystemAssignedServiceIdentity>          identity = default;
            Optional <ResourceModelWithAllowedPropertySetSku> sku      = default;
            Optional <ArmPlan>           plan         = default;
            IDictionary <string, string> tags         = default;
            AzureLocation        location             = default;
            ResourceIdentifier   id                   = default;
            string               name                 = default;
            ResourceType         type                 = default;
            SystemData           systemData           = default;
            Optional <string>    objectId             = default;
            Optional <string>    description          = default;
            Optional <string>    friendlyName         = default;
            string               hostPoolArmPath      = default;
            Optional <string>    workspaceArmPath     = default;
            ApplicationGroupType applicationGroupType = default;
            Optional <MigrationRequestProperties> migrationRequest = default;
            Optional <bool> cloudPcResource = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("managedBy"))
                {
                    managedBy = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <SystemAssignedServiceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = ResourceModelWithAllowedPropertySetSku.DeserializeResourceModelWithAllowedPropertySetSku(property.Value);
                    continue;
                }
                if (property.NameEquals("plan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    plan = JsonSerializer.Deserialize <ArmPlan>(property.Value.ToString());
                    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 = 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 = 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("objectId"))
                        {
                            objectId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("friendlyName"))
                        {
                            friendlyName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hostPoolArmPath"))
                        {
                            hostPoolArmPath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("workspaceArmPath"))
                        {
                            workspaceArmPath = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("applicationGroupType"))
                        {
                            applicationGroupType = new ApplicationGroupType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("migrationRequest"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            migrationRequest = MigrationRequestProperties.DeserializeMigrationRequestProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("cloudPcResource"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cloudPcResource = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualApplicationGroupData(id, name, type, systemData, tags, location, managedBy.Value, kind.Value, etag.Value, identity, sku.Value, plan, objectId.Value, description.Value, friendlyName.Value, hostPoolArmPath, workspaceArmPath.Value, applicationGroupType, migrationRequest.Value, Optional.ToNullable(cloudPcResource)));
        }
예제 #4
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(ManagedBy))
     {
         writer.WritePropertyName("managedBy");
         writer.WriteStringValue(ManagedBy);
     }
     if (Optional.IsDefined(Kind))
     {
         writer.WritePropertyName("kind");
         writer.WriteStringValue(Kind);
     }
     if (Optional.IsDefined(Identity))
     {
         writer.WritePropertyName("identity");
         JsonSerializer.Serialize(writer, Identity);
     }
     if (Optional.IsDefined(Sku))
     {
         writer.WritePropertyName("sku");
         writer.WriteObjectValue(Sku);
     }
     if (Optional.IsDefined(Plan))
     {
         writer.WritePropertyName("plan");
         JsonSerializer.Serialize(writer, Plan);
     }
     writer.WritePropertyName("tags");
     writer.WriteStartObject();
     foreach (var item in Tags)
     {
         writer.WritePropertyName(item.Key);
         writer.WriteStringValue(item.Value);
     }
     writer.WriteEndObject();
     writer.WritePropertyName("location");
     writer.WriteStringValue(Location);
     writer.WritePropertyName("properties");
     writer.WriteStartObject();
     if (Optional.IsDefined(Description))
     {
         writer.WritePropertyName("description");
         writer.WriteStringValue(Description);
     }
     if (Optional.IsDefined(FriendlyName))
     {
         writer.WritePropertyName("friendlyName");
         writer.WriteStringValue(FriendlyName);
     }
     writer.WritePropertyName("hostPoolArmPath");
     writer.WriteStringValue(HostPoolArmPath);
     writer.WritePropertyName("applicationGroupType");
     writer.WriteStringValue(ApplicationGroupType.ToString());
     if (Optional.IsDefined(MigrationRequest))
     {
         writer.WritePropertyName("migrationRequest");
         writer.WriteObjectValue(MigrationRequest);
     }
     writer.WriteEndObject();
     writer.WriteEndObject();
 }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="ApplicationGroupType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ApplicationGroupType.CreateFrom(sourceValue);