Esempio n. 1
0
 internal Workspace(string id, string name, Identity identity, string location, string type, IDictionary <string, string> tags, Sku sku, string workspaceId, string description, string friendlyName, DateTimeOffset?creationTime, string keyVault, string applicationInsights, string containerRegistry, string storageAccount, string discoveryUrl, ProvisioningState?provisioningState, EncryptionProperty encryption, bool?hbiWorkspace, string serviceProvisionedResourceGroup, int?privateLinkCount, string imageBuildCompute, bool?allowPublicAccessWhenBehindVnet, IReadOnlyList <PrivateEndpointConnection> privateEndpointConnections, IList <SharedPrivateLinkResource> sharedPrivateLinkResources) : base(id, name, identity, location, type, tags, sku)
 {
     WorkspaceId                     = workspaceId;
     Description                     = description;
     FriendlyName                    = friendlyName;
     CreationTime                    = creationTime;
     KeyVault                        = keyVault;
     ApplicationInsights             = applicationInsights;
     ContainerRegistry               = containerRegistry;
     StorageAccount                  = storageAccount;
     DiscoveryUrl                    = discoveryUrl;
     ProvisioningState               = provisioningState;
     Encryption                      = encryption;
     HbiWorkspace                    = hbiWorkspace;
     ServiceProvisionedResourceGroup = serviceProvisionedResourceGroup;
     PrivateLinkCount                = privateLinkCount;
     ImageBuildCompute               = imageBuildCompute;
     AllowPublicAccessWhenBehindVnet = allowPublicAccessWhenBehindVnet;
     PrivateEndpointConnections      = privateEndpointConnections;
     SharedPrivateLinkResources      = sharedPrivateLinkResources;
 }
        internal static Workspace DeserializeWorkspace(JsonElement element)
        {
            Optional <string>   id       = default;
            Optional <string>   name     = default;
            Optional <Identity> identity = default;
            Optional <string>   location = default;
            Optional <string>   type     = default;
            Optional <IDictionary <string, string> > tags                 = default;
            Optional <Sku>                sku                             = default;
            Optional <string>             workspaceId                     = default;
            Optional <string>             description                     = default;
            Optional <string>             friendlyName                    = default;
            Optional <DateTimeOffset>     creationTime                    = default;
            Optional <string>             keyVault                        = default;
            Optional <string>             applicationInsights             = default;
            Optional <string>             containerRegistry               = default;
            Optional <string>             storageAccount                  = default;
            Optional <string>             discoveryUrl                    = default;
            Optional <ProvisioningState>  provisioningState               = default;
            Optional <EncryptionProperty> encryption                      = default;
            Optional <bool>               hbiWorkspace                    = default;
            Optional <string>             serviceProvisionedResourceGroup = default;
            Optional <int>                privateLinkCount                = default;
            Optional <string>             imageBuildCompute               = default;
            Optional <bool>               allowPublicAccessWhenBehindVnet = default;
            Optional <IReadOnlyList <PrivateEndpointConnection> > privateEndpointConnections = default;
            Optional <IList <SharedPrivateLinkResource> >         sharedPrivateLinkResources = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = Identity.DeserializeIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("workspaceId"))
                        {
                            workspaceId = 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("creationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("keyVault"))
                        {
                            keyVault = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("applicationInsights"))
                        {
                            applicationInsights = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("containerRegistry"))
                        {
                            containerRegistry = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("storageAccount"))
                        {
                            storageAccount = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("discoveryUrl"))
                        {
                            discoveryUrl = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = EncryptionProperty.DeserializeEncryptionProperty(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hbiWorkspace"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hbiWorkspace = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("serviceProvisionedResourceGroup"))
                        {
                            serviceProvisionedResourceGroup = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("privateLinkCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            privateLinkCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("imageBuildCompute"))
                        {
                            imageBuildCompute = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("allowPublicAccessWhenBehindVnet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowPublicAccessWhenBehindVnet = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnection> array = new List <PrivateEndpointConnection>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnection.DeserializePrivateEndpointConnection(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("sharedPrivateLinkResources"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <SharedPrivateLinkResource> array = new List <SharedPrivateLinkResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(SharedPrivateLinkResource.DeserializeSharedPrivateLinkResource(item));
                            }
                            sharedPrivateLinkResources = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new Workspace(id.Value, name.Value, identity.Value, location.Value, type.Value, Optional.ToDictionary(tags), sku.Value, workspaceId.Value, description.Value, friendlyName.Value, Optional.ToNullable(creationTime), keyVault.Value, applicationInsights.Value, containerRegistry.Value, storageAccount.Value, discoveryUrl.Value, Optional.ToNullable(provisioningState), encryption.Value, Optional.ToNullable(hbiWorkspace), serviceProvisionedResourceGroup.Value, Optional.ToNullable(privateLinkCount), imageBuildCompute.Value, Optional.ToNullable(allowPublicAccessWhenBehindVnet), Optional.ToList(privateEndpointConnections), Optional.ToList(sharedPrivateLinkResources)));
        }