# Module `netapp_ontap.resources.xc_lun`

Copyright © 2022 NetApp Inc. All rights reserved.

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

## Classes

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

  lun clone for cluster peer.

  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 count_collection(*args, connection: HostConnection = None, **kwargs) -> int`

    Fetch a count of all objects of this type from the host.

    This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

    ## Args

    `*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 get the count of bars for a particular foo, the foo.name value should be passed.
    `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. These query parameters can affect the count. A return_records query param will be ignored.

    ## Returns

    On success, returns an integer count of the objects of this type. On failure, returns -1.

    ## Raises

    `NetAppRestError`: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

  `def find(*args, connection: HostConnection = None, **kwargs) -> Resource`

    Cross cluster GET LUNs

    Find an instance of an object on the host given a query.

    The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

    ## Args

    `*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 find a bar for a particular foo, the foo.name value should be passed.
    `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.

    ## Returns

    A `Resource` object containing the details of the object or None if no matches were found.

    ## Raises

    `NetAppRestError`: If the API call returned more than 1 matching resource.

  `def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]`

    Cross cluster GET LUNs

    Fetch a list of all objects of this type from the host.

    This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

    ## Args

    `*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 get the collection of bars for a particular foo, the foo.name value should be passed.
    `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.
    `max_records`
      The maximum number of records to return per call
    `**kwargs`
      Any key/value pairs passed will be sent as query parameters to the host.

    ## Returns

    A list of `Resource` objects

    ## Raises

    `NetAppRestError`: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

  ### Inherited members

  - `Resource`:
    - `from_dict`
    - `get_collection_url`
    - `get_connection`
    - `instance_location`
    - `path_keys`
    - `poll`
    - `set_connection`
    - `to_dict`
`class XcLunSchema (*, 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 XcLun object

  ### Ancestors

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

  ### Class variables

  `attributes: List[LunAttributes] GET POST`

    An array of name/value pairs optionally stored with the LUN. Attributes are available to callers to persist small amounts of application-specific metadata. They are in no way interpreted by ONTAP.
    Attribute names and values must be at least one byte and no more than 4091 bytes in length. The sum of the name and value lengths must be no more than 4092 bytes.
    Valid in POST except when creating a LUN clone. A cloned can already have attributes from its source. You can add, modify, and delete the attributes of a LUN clone in separate requests after creation of the LUN.
    Attributes may be added/modified/removed for an existing LUN using the /api/storage/luns/{lun.uuid}/attributes endpoint. For further information, see `DOC /storage/luns/{lun.uuid}/attributes`.
    There is an added cost to retrieving property values for `attributes`. They are not populated for either a collection GET or an instance GET unless explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more.

  `auto_delete: bool GET POST PATCH`

    This property marks the LUN for auto deletion when the volume containing the LUN runs out of space. This is most commonly set on LUN clones.
    When set to true, the LUN becomes eligible for automatic deletion when the volume runs out of space. Auto deletion only occurs when the volume containing the LUN is also configured for auto deletion and free space in the volume decreases below a particular threshold.
    This property is optional in POST and PATCH. The default value for a new LUN is false.
    There is an added cost to retrieving this property's value. It is not populated for either a collection GET or an instance GET unless it is explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more.

  `class_: str GET POST`

    The class of LUN.
    Optional in POST.

    Valid choices:

    - regular
    - protocol_endpoint
    - vvol
  `clone: ConsistencyGroupConsistencyGroupsLunsClone POST PATCH`

    The clone field of the xc_lun.

  `comment: str GET POST PATCH`

    A configurable comment available for use by the administrator. Valid in POST and PATCH.

  `consistency_group: LunConsistencyGroup GET POST PATCH`

    The consistency_group field of the xc_lun.

  `convert: LunConvert POST`

    The convert field of the xc_lun.

  `copy: LunCopy GET POST PATCH`

    The copy field of the xc_lun.

  `create_time: ImpreciseDateTime GET`

    The time the LUN was created.

    Example: 2018-06-04T19:00:00Z

  `enabled: bool GET PATCH`

    The enabled state of the LUN. LUNs can be disabled to prevent access to the LUN. Certain error conditions also cause the LUN to become disabled. If the LUN is disabled, you can consult the `state` property to determine if the LUN is administratively disabled (offline) or has become disabled as a result of an error. A LUN in an error condition can be brought online by setting the `enabled` property to true or brought administratively offline by setting the `enabled` property to false. Upon creation, a LUN is enabled by default. Valid in PATCH.

  `links: SelfLink GET`

    The links field of the xc_lun.

  `location: LunLocation GET POST PATCH`

    The location field of the xc_lun.

  `lun_maps: List[LunLunMaps] GET`

    The LUN maps with which the LUN is associated.
    There is an added cost to retrieving property values for `lun_maps`. They are not populated for either a collection GET or an instance GET unless explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more.

  `metric: PerformanceMetric GET`

    The metric field of the xc_lun.

  `movement: LunMovement GET POST PATCH`

    The movement field of the xc_lun.

  `name: str GET POST PATCH`

    The fully qualified path name of the LUN composed of a "/vol" prefix, the volume name, the (optional) qtree name, and base name of the LUN. Valid in POST and PATCH.
    A PATCH that modifies the qtree and/or base name portion of the LUN path is considered a rename operation.
    A PATCH that modifies the volume portion of the LUN path begins an asynchronous LUN movement operation.

    Example: /vol/volume1/qtree1/lun1

  `os_type: str GET POST`

    The operating system type of the LUN.
    Required in POST when creating a LUN that is not a clone of another. Disallowed in POST when creating a LUN clone.

    Valid choices:

    - aix
    - hpux
    - hyper_v
    - linux
    - netware
    - openvms
    - solaris
    - solaris_efi
    - vmware
    - windows
    - windows_2008
    - windows_gpt
    - xen
  `qos_policy: LunQosPolicy GET POST PATCH`

    The qos_policy field of the xc_lun.

  `serial_number: str GET`

    The LUN serial number. The serial number is generated by ONTAP when the LUN is created.

  `space: LunSpace GET POST PATCH`

    The space field of the xc_lun.

  `statistics: PerformanceMetricRaw GET`

    The statistics field of the xc_lun.

  `status: LunStatus GET POST PATCH`

    The status field of the xc_lun.

  `svm: Svm GET POST PATCH`

    The svm field of the xc_lun.

  `uuid: str GET`

    The unique identifier of the LUN. The UUID is generated by ONTAP when the LUN is created.

    Example: 1cd8a442-86d1-11e0-ae1c-123478563412

  `vvol: LunVvol GET POST PATCH`

    The vvol field of the xc_lun.