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

# Module `netapp_ontap.resources.container`

Copyright © 2026 NetApp Inc. All rights reserved.

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

## Overview

Application containers provision one or more storage objects. Currently, only NAS volumes are supported. Application containers allow you to specify the policies and rules for enabling and managing client access to storage. FlexCache volumes can also be provisioned.

## Examples

### Creating a FlexVol with NAS (NFS and CIFS access) along with S3 NAS bucket with S3 access policies

    from netapp_ontap import HostConnection
    from netapp_ontap.resources import Container

    with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
        resource = Container()
        resource.svm = {"name": "vs0"}
        resource.volumes = [
            {
                "name": "vol1",
                "space": {"size": "100mb"},
                "scale_out": "false",
                "nas": {
                    "path": "/vol1",
                    "export_policy": {
                        "name": "vol1",
                        "rules": [
                            {
                                "clients": [{"match": "0.0.0.0/0"}],
                                "rw_rule": ["any"],
                                "ro_rule": ["any"],
                            }
                        ],
                    },
                    "cifs": {
                        "shares": [
                            {
                                "name": "vol1",
                                "acls": [
                                    {
                                        "type": "windows",
                                        "permission": "full_control",
                                        "user_or_group": "everyone",
                                    }
                                ],
                            }
                        ]
                    },
                },
                "s3_bucket": {
                    "name": "vol1",
                    "nas_path": "/vol1",
                    "policy": {
                        "statements": [
                            {
                                "actions": ["ListBucket"],
                                "effect": "allow",
                                "principals": ["user1", "group/grp1"],
                                "resources": ["vol1", "vol1/*"],
                            }
                        ]
                    },
                },
            }
        ]
        resource.post(hydrate=True)
        print(resource)

Try it out

    Container(
        {
            "volumes": [
                {
                    "scale_out": False,
                    "space": {"size": 104857600},
                    "name": "vol1",
                    "s3_bucket": {
                        "policy": {
                            "statements": [
                                {
                                    "effect": "allow",
                                    "resources": ["vol1", "vol1/*"],
                                    "actions": ["ListBucket"],
                                    "principals": ["user1", "group/grp1"],
                                }
                            ]
                        },
                        "name": "vol1",
                        "nas_path": "/vol1",
                    },
                    "nas": {
                        "export_policy": {
                            "name": "vol1",
                            "rules": [
                                {
                                    "ro_rule": ["any"],
                                    "clients": [{"match": "0.0.0.0/0"}],
                                    "rw_rule": ["any"],
                                }
                            ],
                        },
                        "cifs": {
                            "shares": [
                                {
                                    "name": "vol1",
                                    "acls": [
                                        {
                                            "user_or_group": "everyone",
                                            "permission": "full_control",
                                            "type": "windows",
                                        }
                                    ],
                                }
                            ]
                        },
                        "path": "/vol1",
                    },
                }
            ],
            "svm": {"name": "vs0"},
        }
    )

## Classes

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

  Allows interaction with Container objects on the host

  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('Container')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[Container], NetAppResponse]`

    * POST is not supported Creates one or more of the following: * New NAS FlexVol or FlexGroup volumes * S3 buckets * Access policies for NFS, CIFS and S3 * FlexCache volumes

    ## Required properties

    - `svm.uuid` or `svm.name` - Existing SVM in which to create the container.
    - `volumes`

    ## Naming Conventions

    ### Volume

    - volumes[].name, if specified
    - suffixed by "_#" where "#" is a system generated unique number, if provisioning_options.count is provided

    ### Learn more

    - `DOC /application/containers`

    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`

    * POST is not supported Creates one or more of the following: * New NAS FlexVol or FlexGroup volumes * S3 buckets * Access policies for NFS, CIFS and S3 * FlexCache volumes

    ## Required properties

    - `svm.uuid` or `svm.name` - Existing SVM in which to create the container.
    - `volumes`

    ## Naming Conventions

    ### Volume

    - volumes[].name, if specified
    - suffixed by "_#" where "#" is a system generated unique number, if provisioning_options.count is provided

    ### Learn more

    - `DOC /application/containers`

    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.
    `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 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`
    - `validate_schema`
`class ContainerSchema (*, only: types.StrSequenceOrSet | None = None, exclude: types.StrSequenceOrSet = (), many: bool | None = None, context: dict | None = None, load_only: types.StrSequenceOrSet = (), dump_only: types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet | None = None, unknown: str | None = None)`

  The fields of the Container object

  ### Ancestors

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

  ### Class variables

  `provisioning_options: ContainerProvisioningOptions POST`

    Options that are applied to the operation.

  `svm: Svm POST`

    The svm field of the container.

  `use_mirrored_aggregates: bool POST`

    Specifies whether mirrored aggregates are selected when provisioning the volume. Only mirrored aggregates are used if this parameter is set to true and only unmirrored aggregates are used if this parameter is set to false. The default value is true for a MetroCluster configuration and is false for a non-MetroCluster configuration.

  `volumes: List[ContainerVolume] GET POST PATCH`

    A list of NAS volumes to provision.