Example #1
0
 internal PatchableStaticSiteARMResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, string defaultHostname, Uri repositoryUri, string branch, IReadOnlyList <string> customDomains, string repositoryToken, StaticSiteBuildProperties buildProperties, IReadOnlyList <ResponseMessageEnvelopeRemotePrivateEndpointConnection> privateEndpointConnections, StagingEnvironmentPolicy?stagingEnvironmentPolicy, bool?allowConfigFileUpdates, StaticSiteTemplateOptions templateProperties, string contentDistributionEndpoint, string keyVaultReferenceIdentity, IReadOnlyList <StaticSiteUserProvidedFunctionApp> userProvidedFunctionApps, string provider) : base(id, name, resourceType, systemData, kind)
 {
     DefaultHostname             = defaultHostname;
     RepositoryUri               = repositoryUri;
     Branch                      = branch;
     CustomDomains               = customDomains;
     RepositoryToken             = repositoryToken;
     BuildProperties             = buildProperties;
     PrivateEndpointConnections  = privateEndpointConnections;
     StagingEnvironmentPolicy    = stagingEnvironmentPolicy;
     AllowConfigFileUpdates      = allowConfigFileUpdates;
     TemplateProperties          = templateProperties;
     ContentDistributionEndpoint = contentDistributionEndpoint;
     KeyVaultReferenceIdentity   = keyVaultReferenceIdentity;
     UserProvidedFunctionApps    = userProvidedFunctionApps;
     Provider                    = provider;
 }
        internal static StaticSitesWorkflowPreviewRequest DeserializeStaticSitesWorkflowPreviewRequest(JsonElement element)
        {
            Optional <string>  kind          = default;
            ResourceIdentifier id            = default;
            string             name          = default;
            ResourceType       type          = default;
            Optional <string>  repositoryUrl = default;
            Optional <string>  branch        = default;
            Optional <StaticSiteBuildProperties> buildProperties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = 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("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("repositoryUrl"))
                        {
                            repositoryUrl = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("branch"))
                        {
                            branch = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("buildProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            buildProperties = StaticSiteBuildProperties.DeserializeStaticSiteBuildProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new StaticSitesWorkflowPreviewRequest(id, name, type, kind.Value, repositoryUrl.Value, branch.Value, buildProperties.Value));
        }
 internal StaticSitesWorkflowPreviewRequest(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, Uri repositoryUri, string branch, StaticSiteBuildProperties buildProperties) : base(id, name, resourceType, systemData, kind)
 {
     RepositoryUri   = repositoryUri;
     Branch          = branch;
     BuildProperties = buildProperties;
 }
        internal static StaticSiteARMResourcePatch DeserializeStaticSiteARMResourcePatch(JsonElement element)
        {
            Optional <string>  kind            = default;
            ResourceIdentifier id              = default;
            string             name            = default;
            ResourceType       type            = default;
            SystemData         systemData      = default;
            Optional <string>  defaultHostname = default;
            Optional <Uri>     repositoryUrl   = default;
            Optional <string>  branch          = default;
            Optional <IReadOnlyList <string> > customDomains = default;
            Optional <string> repositoryToken = default;
            Optional <StaticSiteBuildProperties> buildProperties = default;
            Optional <IReadOnlyList <ResponseMessageEnvelopeRemotePrivateEndpointConnection> > privateEndpointConnections = default;
            Optional <StagingEnvironmentPolicy> stagingEnvironmentPolicy = default;
            Optional <bool> allowConfigFileUpdates = default;
            Optional <StaticSiteTemplateOptions> templateProperties = default;
            Optional <string> contentDistributionEndpoint           = default;
            Optional <string> keyVaultReferenceIdentity             = default;
            Optional <IReadOnlyList <StaticSiteUserProvidedFunctionApp> > userProvidedFunctionApps = default;
            Optional <string> provider = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = 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("defaultHostname"))
                        {
                            defaultHostname = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("repositoryUrl"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                repositoryUrl = null;
                                continue;
                            }
                            repositoryUrl = new Uri(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("branch"))
                        {
                            branch = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("customDomains"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            customDomains = array;
                            continue;
                        }
                        if (property0.NameEquals("repositoryToken"))
                        {
                            repositoryToken = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("buildProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            buildProperties = StaticSiteBuildProperties.DeserializeStaticSiteBuildProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ResponseMessageEnvelopeRemotePrivateEndpointConnection> array = new List <ResponseMessageEnvelopeRemotePrivateEndpointConnection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ResponseMessageEnvelopeRemotePrivateEndpointConnection.DeserializeResponseMessageEnvelopeRemotePrivateEndpointConnection(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("stagingEnvironmentPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            stagingEnvironmentPolicy = property0.Value.GetString().ToStagingEnvironmentPolicy();
                            continue;
                        }
                        if (property0.NameEquals("allowConfigFileUpdates"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowConfigFileUpdates = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("templateProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            templateProperties = StaticSiteTemplateOptions.DeserializeStaticSiteTemplateOptions(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("contentDistributionEndpoint"))
                        {
                            contentDistributionEndpoint = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("keyVaultReferenceIdentity"))
                        {
                            keyVaultReferenceIdentity = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("userProvidedFunctionApps"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <StaticSiteUserProvidedFunctionApp> array = new List <StaticSiteUserProvidedFunctionApp>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(StaticSiteUserProvidedFunctionApp.DeserializeStaticSiteUserProvidedFunctionApp(item));
                            }
                            userProvidedFunctionApps = array;
                            continue;
                        }
                        if (property0.NameEquals("provider"))
                        {
                            provider = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new StaticSiteARMResourcePatch(id, name, type, systemData, kind.Value, defaultHostname.Value, repositoryUrl.Value, branch.Value, Optional.ToList(customDomains), repositoryToken.Value, buildProperties.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(stagingEnvironmentPolicy), Optional.ToNullable(allowConfigFileUpdates), templateProperties.Value, contentDistributionEndpoint.Value, keyVaultReferenceIdentity.Value, Optional.ToList(userProvidedFunctionApps), provider.Value));
        }
 internal StaticSitesWorkflowPreviewRequest(ResourceIdentifier id, string name, ResourceType type, string kind, string repositoryUrl, string branch, StaticSiteBuildProperties buildProperties) : base(id, name, type, kind)
 {
     RepositoryUrl   = repositoryUrl;
     Branch          = branch;
     BuildProperties = buildProperties;
 }