# Module `netapp_ontap.resources.capacity_pool_with_optional_node_serials`

Copyright © 2022 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

## Overview

This API manages associations between ONTAP nodes in the cluster with capacity pools. Associations are originally made when an ONTAP cluster is created if the capacity pools licensing model is used. You can update the associations by using this API. Also, if a cluster is originally created to use the capacity tiers licensing model, either with purchased licenses or as an evaluation cluster, you can use this API to update the cluster to use the capacity pools licensing model. Before doing so, configure the license manager instance on which the capacity pool licenses are installed that the cluster will be using. This can be done by sending a POST request on the /api/private/cluster/licensing/license-managers path. Because the node serial number is associated with the original capacity tier license, a new node serial number associated with the capacity pool license must be provided for each of the nodes in the cluster. Note: If a node has the High Availability (HA) feature turned on, both of the HA pair nodes must be associated with the same capacity pool. This is so that new leases from a different capacity pool are not required for storage aggregates when they move from one node to the other during a takeover/giveback event.

## Examples

### Updating all the nodes to be associated with capacity pools that are currently not associated with the cluster

This example updates the two HA pairs of nodes in a four-node cluster to be associated with capacity pools that are currently not associated with the cluster. The license_manager field is omitted in the request, because the licenses of the new capacity pools are installed on the default license manager instance.

####

    # API
    POST /api/private/cluster/licensing/capacity-pools
    # JSON Body
    {
      "records" : [
        {
          "serial_number":"390000200",
          "nodes":[
            {
              "node":{
                "name":"node-1"
              }
            },
            {
              "node":{
                "name":"node-2"
              }
            }
          ]
        },
        {
          "serial_number":"390000201",
          "nodes":[
            {
              "node":{
                "name":"node-3"
              }
            },
            {
              "node":{
                "name":"node-4"
              }
            }
          ]
        }
      ]
    }
    # Response
    202 Accepted

### Updating HA pair nodes to be associated with capacity pool that is currently associated with the other HA pair nodes

This example updates one HA pair of nodes in a four-node cluster to be associated with capacity pool that is currently associated with the other HA pair. Once complete, all of the nodes in the cluster will be associated with the capacity pool whose license serial number is 390000100.

####

    # API
    PATCH /api/private/cluster/licensing/capacity-pools/390000100
    # JSON Body
    {
      "nodes":[
        {
          "node":{
            "name":"node-3"
          }
        },
        {
          "node":{
            "name":"node-4"
          }
        }
      ]
    }
    # Response
    202 Accepted

### Updating a four-node cluster from capacity tiers licensing to pools licensing

This example updates a four-node cluster that is currently using the capacity tiers licensing model to the capacity pools licensing. All of the nodes are assigned to a single capacity pool. First, configure the license manager instance on which the capacity pool license is installed:

####

    # API
    POST /api/private/cluster/licensing/license-managers
    # JSON Body
    {
      "uri": {
        "host":"10.1.1.1"
      }
    }
    # Response
    202 Accepted

Then, make a request to convert the cluster from capacity tiers licensing to pools licensing:

####

    # API
    POST /api/private/cluster/licensing/capacity-pools
    # JSON Body
    {
      "serial_number":"390000300",
      "nodes":[
        {
          "node":{
            "name":"node-1"
          },
          "new_node_serial_number":"99939000030000000001"
        },
        {
          "node":{
            "name":"node-2"
          },
          "new_node_serial_number":"99939000030000000002"
        },
        {
          "node":{
            "name":"node-3"
          },
          "new_node_serial_number":"99939000030000000003"
        },
        {
          "node":{
            "name":"node-4"
          },
          "new_node_serial_number":"99939000030000000004"
        }
      ]
    }
    # Response
    202 Accepted

## Classes

`class CapacityPoolWithOptionalNodeSerials (*args, **kwargs)`

  A capacity pool license to which to reassign nodes. When reassigning nodes as part of converting from capacity tiers licensing, a new node serial number must be provided for each node being converted.

  Initialize the instance of the resource.

  Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

      MyResource(name='foo').name == 'foo'

  ## Args

  `*args`
    Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
  `**kwargs`
    each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

  ### Ancestors

  - Resource

  ### Static methods

  `def post_collection(records: Iterable[_ForwardRef('CapacityPoolWithOptionalNodeSerials')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[CapacityPoolWithOptionalNodeSerials], NetAppResponse]`

    Assigns nodes in the cluster to new capacity pools.

    ### Learn more

    - `DOC /private/cluster/licensing/capacity-pools`
    - `DOC /private/cluster/licensing/license-managers`

    Send this collection of objects to the host as a creation request.

    ## Args

    `records`
      A list of `Resource` objects to send to the server to be created.
    `*args`
      Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to create a bar for a particular foo, the foo.name value should be passed.
    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `connection`
      The `HostConnection` object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

    ## Returns

    A list of `Resource` objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then a `NetAppResponse` object is returned instead.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  ### Methods

  `def post(self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse`

    Assigns nodes in the cluster to new capacity pools.

    ### Learn more

    - `DOC /private/cluster/licensing/capacity-pools`
    - `DOC /private/cluster/licensing/license-managers`

    Send this object to the host as a creation request.

    ## Args

    `hydrate`
      If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
    `poll`
      If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
    `poll_interval`
      If the operation returns a job, this specifies how often to query the job for updates.
    `poll_timeout`
      If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
    `**kwargs`
      Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

    ## Returns

    A `NetAppResponse` object containing the details of the HTTP response.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class CapacityPoolWithOptionalNodeSerialsSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)`

  The fields of the CapacityPoolWithOptionalNodeSerials object

  ### Ancestors

  - netapp_ontap.resource.ResourceSchema
  - marshmallow.schema.Schema
  - marshmallow.base.SchemaABC

  ### Class variables

  `license_manager: LicenseManager GET POST PATCH`

    The license_manager field of the capacity_pool_with_optional_node_serials.

  `links: SelfLink GET`

    The links field of the capacity_pool_with_optional_node_serials.

  `nodes: List[CapacityPoolNodeWithOptionalNewSerial] GET POST PATCH`

    Nodes in the cluster associated with this capacity pool.

  `records: List[CapacityPoolWithOptionalNodeSerialsNoRecords] POST`

    An array of capacity pools specified to add multiple capacity pools in a single API call. Valid in POST only.

  `serial_number: str GET POST PATCH`

    Serial number of the capacity pool license.

    Example: 390000100