コード例 #1
0
        ///GENMHASH:1C73260E17F72F996B485F399B1A7E02:93461D0A597F2906607068C9C6F891F6
        public ContainerGroupImpl WithRestartPolicy(ContainerGroupRestartPolicy restartPolicy)
        {
            this.Inner.RestartPolicy = restartPolicy.ToString();

            return(this);
        }
コード例 #2
0
 ///GENMHASH:72D8F838766D2FA789A06DBB8ACE4C8C:6688B3D6EDBA6430DBE60C201714B737
 public ContainerGroupRestartPolicy RestartPolicy()
 {
     return(ContainerGroupRestartPolicy.Parse(this.Inner.RestartPolicy));
 }
コード例 #3
0
 /// <summary>
 /// Specifies the restart policy for all the container instances within the container group.
 /// </summary>
 /// <param name="restartPolicy">The restart policy for all the container instances within the container group.</param>
 /// <return>The next stage of the definition.</return>
 ContainerGroup.Definition.IWithCreate ContainerGroup.Definition.IWithRestartPolicyBeta.WithRestartPolicy(ContainerGroupRestartPolicy restartPolicy)
 {
     return(this.WithRestartPolicy(restartPolicy));
 }
コード例 #4
0
        ///GENMHASH:1C73260E17F72F996B485F399B1A7E02:93461D0A597F2906607068C9C6F891F6
        public ContainerGroupImpl WithRestartPolicy(ContainerGroupRestartPolicy restartPolicy)
        {
            this.Inner.RestartPolicy = restartPolicy.Value;

            return(this);
        }
コード例 #5
0
 /// <summary>
 /// Converts the <paramref name="sourceValue" /> parameter to the <paramref name="destinationType" /> parameter using <paramref
 /// name="formatProvider" /> and <paramref name="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="ContainerGroupRestartPolicy" />, 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) => ContainerGroupRestartPolicy.CreateFrom(sourceValue);
コード例 #6
0
        internal static ContainerGroupData DeserializeContainerGroupData(JsonElement element)
        {
            Optional <ManagedServiceIdentity> identity = default;
            Optional <IList <string> >        zones    = default;
            IDictionary <string, string>      tags     = default;
            AzureLocation      location          = default;
            ResourceIdentifier id                = default;
            string             name              = default;
            ResourceType       type              = default;
            SystemData         systemData        = default;
            Optional <string>  provisioningState = default;
            IList <ContainerInstanceContainer>          containers = default;
            Optional <IList <ImageRegistryCredential> > imageRegistryCredentials = default;
            Optional <ContainerGroupRestartPolicy>      restartPolicy            = default;
            Optional <IPAddress> ipAddress = default;
            OperatingSystemTypes osType    = default;
            Optional <IList <ContainerInstanceVolume> >     volumes                 = default;
            Optional <ContainerGroupPropertiesInstanceView> instanceView            = default;
            Optional <ContainerGroupDiagnostics>            diagnostics             = default;
            Optional <IList <ContainerGroupSubnetId> >      subnetIds               = default;
            Optional <DnsConfiguration>                        dnsConfig            = default;
            Optional <ContainerGroupSku>                       sku                  = default;
            Optional <Models.EncryptionProperties>             encryptionProperties = default;
            Optional <IList <InitContainerDefinitionContent> > initContainers       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ManagedServiceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    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 = new AzureLocation(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 = new ResourceType(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("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("containers"))
                        {
                            List <ContainerInstanceContainer> array = new List <ContainerInstanceContainer>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ContainerInstanceContainer.DeserializeContainerInstanceContainer(item));
                            }
                            containers = array;
                            continue;
                        }
                        if (property0.NameEquals("imageRegistryCredentials"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ImageRegistryCredential> array = new List <ImageRegistryCredential>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ImageRegistryCredential.DeserializeImageRegistryCredential(item));
                            }
                            imageRegistryCredentials = array;
                            continue;
                        }
                        if (property0.NameEquals("restartPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            restartPolicy = new ContainerGroupRestartPolicy(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("ipAddress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            ipAddress = IPAddress.DeserializeIPAddress(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("osType"))
                        {
                            osType = new OperatingSystemTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("volumes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ContainerInstanceVolume> array = new List <ContainerInstanceVolume>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ContainerInstanceVolume.DeserializeContainerInstanceVolume(item));
                            }
                            volumes = array;
                            continue;
                        }
                        if (property0.NameEquals("instanceView"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            instanceView = ContainerGroupPropertiesInstanceView.DeserializeContainerGroupPropertiesInstanceView(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("diagnostics"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            diagnostics = ContainerGroupDiagnostics.DeserializeContainerGroupDiagnostics(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("subnetIds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ContainerGroupSubnetId> array = new List <ContainerGroupSubnetId>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ContainerGroupSubnetId.DeserializeContainerGroupSubnetId(item));
                            }
                            subnetIds = array;
                            continue;
                        }
                        if (property0.NameEquals("dnsConfig"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dnsConfig = DnsConfiguration.DeserializeDnsConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sku"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sku = new ContainerGroupSku(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("encryptionProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryptionProperties = Models.EncryptionProperties.DeserializeEncryptionProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("initContainers"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <InitContainerDefinitionContent> array = new List <InitContainerDefinitionContent>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(InitContainerDefinitionContent.DeserializeInitContainerDefinitionContent(item));
                            }
                            initContainers = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ContainerGroupData(id, name, type, systemData, tags, location, Optional.ToList(zones), identity, provisioningState.Value, containers, Optional.ToList(imageRegistryCredentials), Optional.ToNullable(restartPolicy), ipAddress.Value, osType, Optional.ToList(volumes), instanceView.Value, diagnostics.Value, Optional.ToList(subnetIds), dnsConfig.Value, Optional.ToNullable(sku), encryptionProperties.Value, Optional.ToList(initContainers)));
        }