Module netapp_ontap.resources.s3_bucket
Copyright © 2020 NetApp Inc. All rights reserved.
Overview
An S3 bucket is a container of objects. Each bucket defines an object namespace. S3 server requests specify objects using a bucket-name and object-name pair. An object consists of data, along with optional metadata and access controls, that is accessible using a name. An object resides within a bucket. There can be more than one bucket in an S3 server. Buckets that are created for the server are associated with an S3 user that is created on the S3 server.
Examples
Retrieving all fields for all S3 buckets of a cluster
from netapp_ontap import HostConnection
from netapp_ontap.resources import S3Bucket
with HostConnection(
"10.140.117.223", username="admin", password="password", verify=False
):
print(list(S3Bucket.get_collection(fields="*")))
[
S3Bucket(
{
"comment": "S3 bucket.",
"name": "bucket-2",
"uuid": "527812ab-7c6d-11e9-97e8-0050568ea123",
"volume": {
"uuid": "51276f5f-7c6d-11e9-97e8-0050568ea123",
"name": "fg_oss_1558514455",
},
"size": 209715200,
"svm": {"uuid": "12f3ba4c-7ae0-11e9-8c06-0050568ea123", "name": "vs1"},
"encryption": {"enabled": False},
"logical_used_size": 157286400,
}
),
S3Bucket(
{
"comment": "bucket1",
"name": "bucket-1",
"uuid": "a8234aec-7e06-11e9-97e8-0050568ea123",
"volume": {
"uuid": "a36a1ea7-7e06-11e9-97e8-0050568ea123",
"name": "fg_oss_1558690256",
},
"size": 1677721600,
"svm": {"uuid": "12f3ba4c-7ae0-11e9-8c06-0050568ea123", "name": "vs1"},
"encryption": {"enabled": False},
"logical_used_size": 0,
}
),
S3Bucket(
{
"comment": "bucket3",
"name": "bucket-3",
"uuid": "19283b75-7ae2-11e9-8abe-0050568ea123",
"volume": {
"uuid": "a46a1ea7-7e06-11e9-97e8-0050568ea123",
"name": "fg_oss_1558690257",
},
"size": 1677721600,
"svm": {"uuid": "ee30eb2d-7ae1-11e9-8abe-0050568ea123", "name": "vs2"},
"encryption": {"enabled": False},
"logical_used_size": 1075838976,
}
),
]
Retrieving all S3 buckets of a cluster ordered by size
from netapp_ontap import HostConnection
from netapp_ontap.resources import S3Bucket
with HostConnection(
"10.140.117.223", username="admin", password="password", verify=False
):
print(list(S3Bucket.get_collection(order_by="size")))
[
S3Bucket(
{
"name": "bb1",
"uuid": "754389d0-7e13-11e9-bfdc-0050568ea123",
"size": 83886080,
"svm": {"uuid": "12f3ba4c-7ae0-11e9-8c06-0050568ea123", "name": "vs1"},
}
),
S3Bucket(
{
"name": "bb2",
"uuid": "19283b75-7ae2-11e9-8abe-0050568ea123",
"size": 838860800,
"svm": {"uuid": "ee30eb2d-7ae1-11e9-8abe-0050568ea123", "name": "vs2"},
}
),
S3Bucket(
{
"name": "bucket-1",
"uuid": "a8234aec-7e06-11e9-97e8-0050568ea123",
"size": 1677721600,
"svm": {"uuid": "12f3ba4c-7ae0-11e9-8c06-0050568ea123", "name": "vs1"},
}
),
]
Retrieving all S3 buckets of a cluster with name "bb2"
from netapp_ontap import HostConnection
from netapp_ontap.resources import S3Bucket
with HostConnection(
"10.140.117.223", username="admin", password="password", verify=False
):
print(list(S3Bucket.get_collection(name="bb2")))
[
S3Bucket(
{
"name": "bb2",
"uuid": "087d940e-7e15-11e9-bfdc-0050568ea123",
"svm": {"uuid": "12f3ba4c-7ae0-11e9-8c06-0050568ea123", "name": "vs1"},
}
),
S3Bucket(
{
"name": "bb2",
"uuid": "19283b75-7ae2-11e9-8abe-0050568ea123",
"svm": {"uuid": "ee30eb2d-7ae1-11e9-8abe-0050568ea123", "name": "vs2"},
}
),
]
Classes
class S3Bucket (*args, **kwargs)-
A bucket is a container of objects. Each bucket defines an object namespace. S3 requests specify objects using a bucket-name and object-name pair. An object resides within a bucket.
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
Static methods
def count_collection(*args, connection: HostConnection = None, **kwargs) -> int-
Retrieves all S3 buckets for all SVMs.
Related ONTAP commands
vserver object-store-server bucket show
Learn more
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
HostConnectionobject 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 all S3 buckets for all SVMs.
Related ONTAP commands
vserver object-store-server bucket show
Learn more
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
HostConnectionobject 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
Resourceobject 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 all S3 buckets for all SVMs.
Related ONTAP commands
vserver object-store-server bucket show
Learn more
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
HostConnectionobject 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
ResourceobjectsRaises
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 s3_bucket_show(comment: cliche.arg_types.choices.Choices.define.._Choices = None, constituents_per_aggregate: cliche.arg_types.choices.Choices.define. ._Choices = None, logical_used_size: cliche.arg_types.choices.Choices.define. ._Choices = None, name: cliche.arg_types.choices.Choices.define. ._Choices = None, size: cliche.arg_types.choices.Choices.define. ._Choices = None, uuid: cliche.arg_types.choices.Choices.define. ._Choices = None, fields: typing.List = None) -> netapp_ontap.resource_table.ResourceTable -
Fetch a list of S3Bucket resources
Args
comment- Can contain any additional information about the bucket being created or modified.
constituents_per_aggregate- Specifies the number of constituents or FlexVol volumes per aggregate. A FlexGroup volume consisting of all such constituents across all specified aggregates is created. This option is used along with the aggregates option and cannot be used independently.
logical_used_size- Specifies the bucket logical used size up to this point.
name- Specifies the name of the bucket. Bucket name is a string that can only contain the following combination of ASCII-range alphanumeric characters 0-9, a-z, ".", and "-".
size- Specifies the bucket size in bytes; ranges from 80MB to 64TB.
uuid- Specifies the unique identifier of the bucket.
Inherited members
class S3BucketSchema (*, 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 S3Bucket object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.base.SchemaABC
Class variables
-
aggregates POST -
A list of aggregates for FlexGroup volume constituents where the bucket is hosted. If this option is not specified, the bucket is auto-provisioned as a FlexGroup volume.
-
comment GET POST PATCH -
Can contain any additional information about the bucket being created or modified.
Example: S3 bucket.
-
constituents_per_aggregate POST -
Specifies the number of constituents or FlexVol volumes per aggregate. A FlexGroup volume consisting of all such constituents across all specified aggregates is created. This option is used along with the aggregates option and cannot be used independently.
Example: 4
-
encryption GET POST PATCH -
The encryption field of the s3_bucket.
-
logical_used_size GET -
Specifies the bucket logical used size up to this point.
-
name GET POST -
Specifies the name of the bucket. Bucket name is a string that can only contain the following combination of ASCII-range alphanumeric characters 0-9, a-z, ".", and "-".
Example: bucket-1
-
size GET POST PATCH -
Specifies the bucket size in bytes; ranges from 80MB to 64TB.
Example: 1677721600
-
svm GET POST PATCH -
The svm field of the s3_bucket.
-
uuid GET -
Specifies the unique identifier of the bucket.
Example: 414b29a1-3b26-11e9-bd58-0050568ea055
-
volume GET POST PATCH -
The volume field of the s3_bucket.