netapp_ontap.resources.flexcache_origin API documentation
Description: Copyright &copy; 2020 NetApp Inc. All rights reserved …

# Module `netapp_ontap.resources.flexcache_origin`

Copyright © 2020 NetApp Inc. All rights reserved.

## Overview

FlexCache is a persistent cache of an origin volume. An origin volume can only be a FlexVol while a FlexCache is always a FlexGroup. The following relationship configurations are supported:

- Intra-Vserver where FlexCache and the corresponding origin volume reside in the same Vserver.
- Cross-Vserver but intra-cluster where FlexCache and the origin volume reside in the same cluster but belong to different Vservers.
- Cross-cluster where FlexCache and the origin volume reside in different clusters. FlexCache supports fan-out and more than one FlexCache can be created from one origin volume. This API retrieves the origin of FlexCache onfigurations in the origin cluster.

## FlexCache APIs

The following APIs can be used to perform operations related to the origin of a FlexCache:

- GET /api/storage/flexcache/origins
- GET /api/storage/flexcache/origins/{uuid}

## Examples

### Retrieving origins of FlexCache attributes

The GET request is used to retrieve the origins of FlexCache attributes.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import FlexcacheOrigin

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        print(list(FlexcacheOrigin.get_collection()))

Try it out

    [
        FlexcacheOrigin(
            {
                "uuid": "2bc957dd-2617-4afb-8d2f-66ac6070d313",
                "_links": {
                    "self": {
                        "href": "/api/storage/flexcache/origins/2bc957dd-2617-4afb-8d2f-66ac6070d313"
                    }
                },
                "name": "vol_o1",
            }
        ),
        FlexcacheOrigin(
            {
                "uuid": "80fcaee4-0dc2-488b-afb8-86d28a34cda8",
                "_links": {
                    "self": {
                        "href": "/api/storage/flexcache/origins/80fcaee4-0dc2-488b-afb8-86d28a34cda8"
                    }
                },
                "name": "vol_1",
            }
        ),
    ]

### Retrieving the attributes of an origin volume

The GET request is used to retrieve the attributes of an origin volume.

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import FlexcacheOrigin

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = FlexcacheOrigin(uuid="80fcaee4-0dc2-488b-afb8-86d28a34cda8")
        resource.get()
        print(resource)

Try it out

    FlexcacheOrigin(
        {
            "uuid": "80fcaee4-0dc2-488b-afb8-86d28a34cda8",
            "_links": {
                "self": {
                    "href": "/api/storage/flexcache/origins/80fcaee4-0dc2-488b-afb8-86d28a34cda8"
                }
            },
            "svm": {"name": "vs_3", "uuid": "8aa2cd28-0e92-11e9-b391-0050568e4115"},
            "name": "vol_1",
            "flexcaches": [
                {
                    "ip_address": "10.140.103.183",
                    "cluster": {
                        "name": "node4",
                        "uuid": "c32f16b8-0e90-11e9-aed0-0050568eddbe",
                    },
                    "create_time": "2019-01-02T19:27:22+05:30",
                    "volume": {
                        "name": "fc_42",
                        "uuid": "4e7f9d49-0e96-11e9-aed0-0050568eddbe",
                    },
                    "svm": {
                        "name": "vs_1_4",
                        "uuid": "36f68322-0e93-11e9-aed0-0050568eddbe",
                    },
                },
                {
                    "ip_address": "10.140.103.183",
                    "cluster": {
                        "name": "node4",
                        "uuid": "c32f16b8-0e90-11e9-aed0-0050568eddbe",
                    },
                    "create_time": "2019-01-02T21:08:34+05:30",
                    "volume": {
                        "name": "fc_421",
                        "uuid": "71ee8f36-0ea4-11e9-aed0-0050568eddbe",
                    },
                    "svm": {
                        "name": "vs_1_4",
                        "uuid": "36f68322-0e93-11e9-aed0-0050568eddbe",
                    },
                },
                {
                    "ip_address": "10.140.103.183",
                    "cluster": {
                        "name": "node4",
                        "uuid": "c32f16b8-0e90-11e9-aed0-0050568eddbe",
                    },
                    "create_time": "2019-01-03T11:14:38+05:30",
                    "volume": {"name": "fc_422"},
                    "svm": {
                        "name": "vs_1_4",
                        "uuid": "36f68322-0e93-11e9-aed0-0050568eddbe",
                    },
                },
                {
                    "ip_address": "10.140.103.179",
                    "cluster": {
                        "name": "node3",
                        "uuid": "8eb21b3b-0e90-11e9-8180-0050568e0b79",
                    },
                    "create_time": "2019-01-02T19:24:14+05:30",
                    "volume": {
                        "name": "fc_32",
                        "uuid": "ddb42bbc-0e95-11e9-8180-0050568e0b79",
                    },
                    "svm": {"name": "vs_1", "uuid": "e708fbe2-0e92-11e9-8180-0050568e0b79"},
                    "size": 4294967296,
                    "state": "online",
                },
                {
                    "ip_address": "10.140.103.179",
                    "cluster": {
                        "name": "node3",
                        "uuid": "8eb21b3b-0e90-11e9-8180-0050568e0b79",
                    },
                    "create_time": "2019-01-02T21:07:23+05:30",
                    "volume": {
                        "name": "fc_321",
                        "uuid": "47902654-0ea4-11e9-8180-0050568e0b79",
                    },
                    "svm": {"name": "vs_1", "uuid": "e708fbe2-0e92-11e9-8180-0050568e0b79"},
                    "size": 4294967296,
                    "state": "online",
                },
                {
                    "ip_address": "10.140.103.179",
                    "cluster": {
                        "name": "node3",
                        "uuid": "8eb21b3b-0e90-11e9-8180-0050568e0b79",
                    },
                    "create_time": "2019-01-03T00:11:38+05:30",
                    "volume": {
                        "name": "fc_322",
                        "uuid": "04d5e07b-0ebe-11e9-8180-0050568e0b79",
                    },
                    "svm": {"name": "vs_1", "uuid": "e708fbe2-0e92-11e9-8180-0050568e0b79"},
                    "size": 4294967296,
                    "state": "online",
                },
                {
                    "ip_address": "10.140.103.179",
                    "cluster": {
                        "name": "node3",
                        "uuid": "8eb21b3b-0e90-11e9-8180-0050568e0b79",
                    },
                    "create_time": "2019-01-03T00:14:52+05:30",
                    "volume": {
                        "name": "fc_323",
                        "uuid": "77e911ff-0ebe-11e9-8180-0050568e0b79",
                    },
                    "svm": {"name": "vs_1", "uuid": "e708fbe2-0e92-11e9-8180-0050568e0b79"},
                    "size": 4294967296,
                    "state": "online",
                },
            ],
        }
    )

## Classes

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

  Defines the origin endpoint of FlexCache.

  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`

    Retrieves origin of FlexCache in the cluster.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `flexcaches.ip_address` - IP address of FlexCache. * `flexcaches.size` - Physical size of FlexCache. * `flexcaches.guarantee.type` - Space guarantee style of FlexCache. * `flexcaches.state` - State of FlexCache.

    ### Related ONTAP commands

    - `volume flexcache origin show-caches`

    ### Learn more

    - `DOC /storage/flexcache/origins`

    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`

    Retrieves origin of FlexCache in the cluster.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `flexcaches.ip_address` - IP address of FlexCache. * `flexcaches.size` - Physical size of FlexCache. * `flexcaches.guarantee.type` - Space guarantee style of FlexCache. * `flexcaches.state` - State of FlexCache.

    ### Related ONTAP commands

    - `volume flexcache origin show-caches`

    ### Learn more

    - `DOC /storage/flexcache/origins`

    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) -> typing.Iterable`

    Retrieves origin of FlexCache in the cluster.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are not included by default in GET results and must be explicitly requested using the `fields` query parameter. See `Requesting specific fields` to learn more. * `flexcaches.ip_address` - IP address of FlexCache. * `flexcaches.size` - Physical size of FlexCache. * `flexcaches.guarantee.type` - Space guarantee style of FlexCache. * `flexcaches.state` - State of FlexCache.

    ### Related ONTAP commands

    - `volume flexcache origin show-caches`

    ### Learn more

    - `DOC /storage/flexcache/origins`

    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.

  ### Methods

  `def get(self, **kwargs) -> NetAppResponse`

    Retrieves attributes of the origin of a FlexCache in the cluster.

    ### Expensive properties

    There is an added cost to retrieving values for these properties. They are included by default in GET results. The recommended method to use this API is to filter and retrieve only the required fields. See `Requesting specific fields` to learn more. * `flexcaches.ip_address` - IP address of FlexCache. * `flexcaches.size` - Physical size of FlexCache. * `flexcaches.guarantee.type` - Space guarantee style of FlexCache. * `flexcaches.state` - State of FlexCache.

    ### Related ONTAP commands

    - `volume flexcache origin show-caches`

    ### Learn more

    - `DOC /storage/flexcache/origins`

    Fetch the details of the object from the host.

    Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

    ## 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 FlexcacheOriginSchema (*, only: typing.Union = None, exclude: typing.Union = (), many: bool = False, context: typing.Dict = None, load_only: typing.Union = (), dump_only: typing.Union = (), partial: typing.Union = False, unknown: str = None)`

  The fields of the FlexcacheOrigin object

  ### Ancestors

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

  ### Class variables

  `flexcaches GET POST`

    The flexcaches field of the flexcache_origin.

  `links GET`

    The links field of the flexcache_origin.

  `name GET POST PATCH`

    Origin volume name

    Example: vol1, vol_2

  `svm GET POST`

    The svm field of the flexcache_origin.

  `uuid GET`

    Origin volume UUID. Unique identifier for origin of FlexCache.

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