Beispiel #1
0
 internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBase targetService, AuthInfoBase authInfo, ClientType?clientType, string provisioningState, VNetSolution vNetSolution, SecretStore secretStore, string scope) : base(id, name, resourceType, systemData)
 {
     TargetService     = targetService;
     AuthInfo          = authInfo;
     ClientType        = clientType;
     ProvisioningState = provisioningState;
     VNetSolution      = vNetSolution;
     SecretStore       = secretStore;
     Scope             = scope;
 }
        internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement element)
        {
            ResourceIdentifier           id                = default;
            string                       name              = default;
            ResourceType                 type              = default;
            SystemData                   systemData        = default;
            Optional <TargetServiceBase> targetService     = default;
            Optional <AuthInfoBase>      authInfo          = default;
            Optional <ClientType>        clientType        = default;
            Optional <string>            provisioningState = default;
            Optional <VnetSolution>      vNetSolution      = default;
            Optional <SecretStore>       secretStore       = default;
            Optional <string>            scope             = 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("targetService"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            targetService = TargetServiceBase.DeserializeTargetServiceBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("authInfo"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            authInfo = AuthInfoBase.DeserializeAuthInfoBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("clientType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            clientType = new ClientType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vNetSolution"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                vNetSolution = null;
                                continue;
                            }
                            vNetSolution = VnetSolution.DeserializeVnetSolution(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("secretStore"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                secretStore = null;
                                continue;
                            }
                            secretStore = SecretStore.DeserializeSecretStore(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("scope"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                scope = null;
                                continue;
                            }
                            scope = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new LinkerResourceData(id, name, type, systemData, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vNetSolution.Value, secretStore.Value, scope.Value));
        }