Ejemplo n.º 1
0
 internal CustomLocationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, SystemAssignedServiceIdentity identity, CustomLocationPropertiesAuthentication authentication, IList <string> clusterExtensionIds, string displayName, string hostResourceId, HostType?hostType, string @namespace, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     Identity            = identity;
     Authentication      = authentication;
     ClusterExtensionIds = clusterExtensionIds;
     DisplayName         = displayName;
     HostResourceId      = hostResourceId;
     HostType            = hostType;
     Namespace           = @namespace;
     ProvisioningState   = provisioningState;
 }
 /// <summary>
 /// Updates a Custom Location.
 /// </summary>
 /// <remarks>
 /// Updates a Custom Location with the specified Resource Name in the specified
 /// Resource Group and Subscription.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='resourceName'>
 /// Custom Locations name.
 /// </param>
 /// <param name='authentication'>
 /// This is optional input that contains the authentication that should be used
 /// to generate the namespace.
 /// </param>
 /// <param name='clusterExtensionIds'>
 /// Contains the reference to the add-on that contains charts to deploy CRDs
 /// and operators.
 /// </param>
 /// <param name='displayName'>
 /// Display name for the Custom Locations location.
 /// </param>
 /// <param name='hostResourceId'>
 /// Connected Cluster or AKS Cluster. The Custom Locations RP will perform a
 /// checkAccess API for listAdminCredentials permissions.
 /// </param>
 /// <param name='hostType'>
 /// Type of host the Custom Locations is referencing (Kubernetes, etc...).
 /// Possible values include: 'Kubernetes'
 /// </param>
 /// <param name='namespaceParameter'>
 /// Kubernetes namespace that will be created on the specified cluster.
 /// </param>
 /// <param name='provisioningState'>
 /// Provisioning State for the Custom Location.
 /// </param>
 /// <param name='tags'>
 /// Resource tags
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <CustomLocation> UpdateAsync(this ICustomLocationsOperations operations, string resourceGroupName, string resourceName, CustomLocationPropertiesAuthentication authentication = default(CustomLocationPropertiesAuthentication), IList <string> clusterExtensionIds = default(IList <string>), string displayName = default(string), string hostResourceId = default(string), string hostType = default(string), string namespaceParameter = default(string), string provisioningState = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, authentication, clusterExtensionIds, displayName, hostResourceId, hostType, namespaceParameter, provisioningState, tags, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 3
0
        internal static CustomLocationData DeserializeCustomLocationData(JsonElement element)
        {
            Optional <SystemAssignedServiceIdentity> identity = default;
            IDictionary <string, string>             tags     = default;
            AzureLocation      location   = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <CustomLocationPropertiesAuthentication> authentication = default;
            Optional <IList <string> > clusterExtensionIds = default;
            Optional <string>          displayName         = default;
            Optional <string>          hostResourceId      = default;
            Optional <HostType>        hostType            = default;
            Optional <string>          @namespace          = default;
            Optional <string>          provisioningState   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <SystemAssignedServiceIdentity>(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 = 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("authentication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            authentication = CustomLocationPropertiesAuthentication.DeserializeCustomLocationPropertiesAuthentication(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("clusterExtensionIds"))
                        {
                            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());
                            }
                            clusterExtensionIds = array;
                            continue;
                        }
                        if (property0.NameEquals("displayName"))
                        {
                            displayName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hostResourceId"))
                        {
                            hostResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("hostType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hostType = new HostType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("namespace"))
                        {
                            @namespace = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new CustomLocationData(id, name, type, systemData, tags, location, identity, authentication.Value, Optional.ToList(clusterExtensionIds), displayName.Value, hostResourceId.Value, Optional.ToNullable(hostType), @namespace.Value, provisioningState.Value));
        }
 /// <summary>
 /// Updates a Custom Location.
 /// </summary>
 /// <remarks>
 /// Updates a Custom Location with the specified Resource Name in the specified
 /// Resource Group and Subscription.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='resourceName'>
 /// Custom Locations name.
 /// </param>
 /// <param name='authentication'>
 /// This is optional input that contains the authentication that should be used
 /// to generate the namespace.
 /// </param>
 /// <param name='clusterExtensionIds'>
 /// Contains the reference to the add-on that contains charts to deploy CRDs
 /// and operators.
 /// </param>
 /// <param name='displayName'>
 /// Display name for the Custom Locations location.
 /// </param>
 /// <param name='hostResourceId'>
 /// Connected Cluster or AKS Cluster. The Custom Locations RP will perform a
 /// checkAccess API for listAdminCredentials permissions.
 /// </param>
 /// <param name='hostType'>
 /// Type of host the Custom Locations is referencing (Kubernetes, etc...).
 /// Possible values include: 'Kubernetes'
 /// </param>
 /// <param name='namespaceParameter'>
 /// Kubernetes namespace that will be created on the specified cluster.
 /// </param>
 /// <param name='provisioningState'>
 /// Provisioning State for the Custom Location.
 /// </param>
 /// <param name='tags'>
 /// Resource tags
 /// </param>
 public static CustomLocation Update(this ICustomLocationsOperations operations, string resourceGroupName, string resourceName, CustomLocationPropertiesAuthentication authentication = default(CustomLocationPropertiesAuthentication), IList <string> clusterExtensionIds = default(IList <string>), string displayName = default(string), string hostResourceId = default(string), string hostType = default(string), string namespaceParameter = default(string), string provisioningState = default(string), IDictionary <string, string> tags = default(IDictionary <string, string>))
 {
     return(operations.UpdateAsync(resourceGroupName, resourceName, authentication, clusterExtensionIds, displayName, hostResourceId, hostType, namespaceParameter, provisioningState, tags).GetAwaiter().GetResult());
 }