diff --git a/.gitignore b/.gitignore index 887fc07232..8c0df13e7e 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,9 @@ env/ docs/warnings.txt docs/_build/ docs/apidocs/ -oraclebmc/models/init_* tests/resources/test_debug.log +tests/resources/*.bin +tests/temp +.vscode/ +.wercker/ +temp \ No newline at end of file diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d75e126945..f7212bd13b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +==================== +1.3.15 - 2018-02-22 +==================== + +Added +----- +* Support for File Storage Service + + * An example on using the File Storage Service can be found on `GitHub `__. + +* Added support for tagging Bucket resources in the Object Storage Service + + * An example on tagging buckets can be found on `GitHub `__. + +* Added support for specifying a restore period for archived objects in the ``RestoreObjects`` operation of the Object Storage service. + + * An example on using archive storage can be found on `GitHub `__. + ==================== 1.3.14 - 2018-02-08 ==================== diff --git a/docs/api/index.rst b/docs/api/index.rst index e6c67fa0ae..c20635e628 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -117,6 +117,28 @@ Virtual Network :imported-members: :inherited-members: +============== + File Storage +============== + +-------- + Client +-------- + +.. autoclass:: oci.file_storage.file_storage_client.FileStorageClient + :members: + +-------- + Models +-------- + +.. automodule:: oci.file_storage.models + :special-members: __init__ + :members: + :undoc-members: + :imported-members: + :inherited-members: + ========== Identity ========== diff --git a/docs/customize_service_client/connection_read_timeout.rst b/docs/customize_service_client/connection_read_timeout.rst new file mode 100644 index 0000000000..d51945ce5d --- /dev/null +++ b/docs/customize_service_client/connection_read_timeout.rst @@ -0,0 +1,35 @@ +.. _read-connection-timeout: + +.. raw:: html + + + +Setting connection and read timeouts +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The Python SDK uses the `Requests `_ library to make calls to OCI services. The SDK uses the Requests `definition `_ for connection and read timeouts. + +By default, calls made to OCI services have no connection or read timeout associated with them (i.e. it is possible to wait forever for a response). If you wish to override this default behaviour and set a timeout, you can do something similar to: + +.. code-block:: python + + import oci + + config = oci.config.from_file() + compute = oci.core.ComputeClient(config) + + # This will set a value of 5 seconds to the connection and read timeout + compute.base_client.timeout = 5 + + # This will set the connection timeout to 2 seconds and the read timeout to 25 seconds + compute.base_client.timeout = (2, 25) + + +You can modify the ``timeout`` attribute of the ``base_client`` to customize our connection and read timeouts. This attribute takes input in the same format as `Requests `_ does, namely: + +* A single value will be applied to both the connection and read timeouts +* If a tuple is provided then the first value is used as the connection timeout and the second as the read timeout \ No newline at end of file diff --git a/docs/customize_service_client/index.rst b/docs/customize_service_client/index.rst new file mode 100644 index 0000000000..37d5c12952 --- /dev/null +++ b/docs/customize_service_client/index.rst @@ -0,0 +1,18 @@ +.. _customize-service-client: + + +Customizing Service Clients +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +SDK service clients can be customized in the following ways: + +* :doc:`Setting connection and read timeouts for requests ` +* :doc:`Using the SDK with a proxy server ` +* :doc:`Injecting custom headers into requests ` + +.. toctree:: + :hidden: + :maxdepth: 2 + + connection_read_timeout + /sdk-with-proxy + setting_custom_headers \ No newline at end of file diff --git a/docs/customize_service_client/setting_custom_headers.rst b/docs/customize_service_client/setting_custom_headers.rst new file mode 100644 index 0000000000..a361512213 --- /dev/null +++ b/docs/customize_service_client/setting_custom_headers.rst @@ -0,0 +1,29 @@ +.. _setting-custom-headers: + +.. raw:: html + + + +Setting custom headers +~~~~~~~~~~~~~~~~~~~~~~~ +The Python SDK uses the `Requests `_ library to make calls to OCI services. If you need to add custom headers to your calls, you can do so via modifying the underlying Requests `Session `_ object + +.. code-block:: python + + import oci + + config = oci.config.from_file() + compute = oci.core.ComputeClient(config) + + # Adds my-custom-header as a header in the request. This header will be included in ALL + # subsequent calls made + compute.base_client.session.headers['my-custom-header'] = 'my custom header value' + + # If you no longer want to send the header then remove it from the dictionary + compute.base_client.session.headers.pop('my-custom-header') + diff --git a/docs/index.rst b/docs/index.rst index 065ef2d5ed..0c79eb992c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -54,8 +54,8 @@ To get started, head over to the :ref:`installation instructions ` or s raw-requests waiters pagination - sdk-with-proxy api/index + customize_service_client/index contributions notifications license diff --git a/docs/quickstart.rst b/docs/quickstart.rst index fae6eab14c..47bd120f98 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -104,30 +104,24 @@ compartment: Even though a response includes a next page, there may not be more results. The last page will return an empty list, and will not have a ``next_page`` token. -Here's a very simple way to paginate a call: +You can manually iterate through responses, providing the page from the previous response to the next request. For example: .. code-block:: python - def paginate(operation, *args, **kwargs): - while True: - response = operation(*args, **kwargs) - for value in response.data: - yield value - kwargs["page"] = response.next_page - if not response.has_next_page: - break + response = identity.list_users(compartment_id) + users = response.data + while response.has_next_page: + response = identity.list_users(compartment_id, page=response.next_page) + users.extend(response.data) -To iterate over all users, the call is now: -.. code-block:: pycon +As a convenience over manually writing pagination code, you can make use of the functions in the :py:mod:`~oci.pagination` module to: - >>> for user in paginate( - ... identity.list_users, - ... compartment_id=compartment_id): - ... print(user) +* Eagerly load all possible results from a list call +* Eagerly load all results from a list call up to a given limit +* Lazily load results (either all results, or up to a given limit) from a list call via a generator. These generators can yield either values/models or the raw response from calling the list operation -This ``paginate`` function will work for any list call, but will not include the response metadata, such as headers, -HTTP status code, or request id. +For examples on pagination, please check `GitHub `__. ------------------- @@ -216,7 +210,7 @@ And to get it back: ============ Next, head to the `User Guides`_ or jump right into the :ref:`API Reference ` -to explore the available operations for each service, and their parameters. Additional Python examples can be found on `GitHub `_. +to explore the available operations for each service, and their parameters. Additional Python examples can be found on `GitHub `__. .. note:: diff --git a/examples/file_storage_example.py b/examples/file_storage_example.py new file mode 100644 index 0000000000..c3cb1f0ec1 --- /dev/null +++ b/examples/file_storage_example.py @@ -0,0 +1,371 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example of how to use the File Storage service in the Python SDK. This script accepts two +# arguments: +# +# * The first argument is the OCID of the compartment where we'll create a file system +# * The second is the name of the availability domain where we'll create a file system +# +# The script will demonstrate: +# +# * Creating a new file system +# * Creating a mount target via which the file system can be accessed. The mount target and file system must +# be in the same availability domain in order to export the file system from the mount target +# * Creating an export so that we can mount the file system (see +# https://docs.us-phoenix-1.oraclecloud.com/Content/File/Tasks/mountingfilesystems.htm for more information) +# * Creating a snapshot of the file system +# +# In order to demonstrate functionality for mount targets and export sets, this script will also create a VCN +# and subnet. These will be deleted at the end of the script. + +import oci +import sys +import time + + +def create_vcn_and_subnet(virtual_network, compartment_id, availability_domain): + vcn_name = 'py_sdk_fs_example_vcn' + cidr_block = "10.0.0.0/16" + vcn_dns_label = 'pysdkfs' + + result = virtual_network.create_vcn( + oci.core.models.CreateVcnDetails( + cidr_block=cidr_block, + display_name=vcn_name, + compartment_id=compartment_id, + dns_label=vcn_dns_label + ) + ) + vcn = oci.wait_until( + virtual_network, + virtual_network.get_vcn(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + + subnet_name = 'py_sdk_fs_example_subnet' + subnet_dns_label = 'pyfssub' + result = virtual_network.create_subnet( + oci.core.models.CreateSubnetDetails( + compartment_id=compartment_id, + availability_domain=availability_domain, + display_name=subnet_name, + vcn_id=vcn.id, + cidr_block=cidr_block, + dns_label=subnet_dns_label + ) + ) + subnet = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + + return {'vcn': vcn, 'subnet': subnet} + + +def delete_vcn_and_subnet(virtual_network, vcn_and_subnet): + vcn = vcn_and_subnet['vcn'] + subnet = vcn_and_subnet['subnet'] + + # Sometimes we can't delete the subnet straight after a mount target has been deleted as network resources + # still need to clear. If we get a conflict, try a few times before bailing out + attempts = 0 + while attempts < 5: + try: + virtual_network.delete_subnet(subnet.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=600, + succeed_on_not_found=True + ) + break + except oci.exceptions.ServiceError as e: + attempts += 1 + if e.status == 409 and attempts < 5: + time.sleep(5) + else: + raise + + virtual_network.delete_vcn(vcn.id) + oci.wait_until( + virtual_network, + virtual_network.get_vcn(vcn.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=600, + succeed_on_not_found=True + ) + + +config = oci.config.from_file() +file_storage_client = oci.file_storage.FileStorageClient(config) +virtual_network_client = oci.core.VirtualNetworkClient(config) + +if len(sys.argv) != 3: + raise RuntimeError('This script expects an argument of the compartment OCID and availability domain where the file system will be created') + +# The first argument is the name of the script, so start the index at 1 +compartment_id = sys.argv[1] +availability_domain = sys.argv[2] + +# Here we apply a retry strategy to the call to ride out any throttles, timeouts or intermittent 500s (internal server +# errors). The retry strategy will also make requests with an opc-retry-token that it generates. +# +# If you do not use the retry_strategy (or have an alternate way of retrying you wish to use instead) we still +# recommend that you use an opc-retry-token in your service calls so that if you receive, say, a timeout or server error +# and need to retry/reissue the request you won't run the risk of creating multiple resources. +create_response = file_storage_client.create_file_system( + oci.file_storage.models.CreateFileSystemDetails( + display_name='py_sdk_example_fs', + compartment_id=compartment_id, + availability_domain=availability_domain + ), + retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY +) + +# A file system has a lifecycle state, we should wait until it is active. Note that wait_until returns a response, so +# to access the model object we use the .data attribute +file_system = oci.wait_until( + file_storage_client, + file_storage_client.get_file_system(create_response.data.id), + 'lifecycle_state', + 'ACTIVE' +).data +print('Created file system:\n{}'.format(file_system)) +print('=============================\n') + +# We can update the display name of the file system +update_response = file_storage_client.update_file_system( + file_system.id, + oci.file_storage.models.UpdateFileSystemDetails(display_name='updated_py_sdk_example_fs') +) +print('Updated file system:\n{}'.format(update_response.data)) +print('=============================\n') + +# Listing file systems is a paginated operation, so we can use the functionality in the oci.pagination +# module to get all the results +all_file_systems = oci.pagination.list_call_get_all_results( + file_storage_client.list_file_systems, + compartment_id, + availability_domain +) +print('All file systems:\n{}'.format(all_file_systems.data)) +print('=============================\n') + +# To create a mount target, first we need a VCN and subnet +vcn_and_subnet = create_vcn_and_subnet(virtual_network_client, compartment_id, availability_domain) +mount_target_name = 'pysdk_example_mt' +subnet = vcn_and_subnet['subnet'] + +# Here we create a mount target but instead of using the retry_strategy we supply an opc-retry-token. This will not +# make the SDK automatically retry in the event of failure but means that if we reissue the same request with the same +# token (e.g. because our original request timed out or we received a 500/internal server error) we avoid the risk +# of multiple resources being created. +# +# The opc-retry-token should uniquely identify the request. The token generation shown here is just an example, but +# in Production code you should have a better way of generating these +# +# Some other items to note about mount target creation: +# - This creates a mount target WITHOUT specifying a hostname. This means that the mount target will only be accessible +# via its private IP address. A hostname can be specified by using the "hostname" attribute of CreateMountTargetDetails +# - A private IP address can be specified by using the "ip_address" attribute of CreateMountTargetDetails. If no explicit +# private IP address is specified then one will be selected from the available pool of free private IPs in the subnet. If +# a private IP address is specified, then it must not already be used +mount_target_retry_token = 'example_token_{}'.format(int(time.time())) +create_response = file_storage_client.create_mount_target( + oci.file_storage.models.CreateMountTargetDetails( + availability_domain=subnet.availability_domain, + subnet_id=subnet.id, + compartment_id=compartment_id, + display_name=mount_target_name + ), + opc_retry_token=mount_target_retry_token +) + +# A mount target also has a lifecycle state, so wait until it is active. Note that wait_until returns a response, so +# to access the model object we use the .data attribute +mount_target = oci.wait_until( + file_storage_client, + file_storage_client.get_mount_target(create_response.data.id), + 'lifecycle_state', + 'ACTIVE' +).data +print('Created mount target:\n{}'.format(mount_target)) +print('=============================\n') + +# If we submit the request to create the mount target with the same retry token then this won't result in a new resource +# but instead the response will contain the same resource which has already been created +create_response_with_retry_token = file_storage_client.create_mount_target( + oci.file_storage.models.CreateMountTargetDetails( + availability_domain=subnet.availability_domain, + subnet_id=subnet.id, + compartment_id=compartment_id, + display_name=mount_target_name + ), + opc_retry_token=mount_target_retry_token +) +print('Created mount target with same request and retry token:\n{}'.format(create_response_with_retry_token.data)) +print('Same mount target returned? {}'.format(mount_target.id == create_response_with_retry_token.data.id)) +print('=============================\n') + +# Note that the MountTarget contains an array of private IP OCIDs. In order to get the +# IP address of the MountTarget, we can use VirtualNetworkClient's get_private_ip function +mount_target_private_ip_id = mount_target.private_ip_ids[0] +get_private_ip_response = virtual_network_client.get_private_ip(mount_target_private_ip_id) +print('Mount target private IP: {}'.format(get_private_ip_response.data.ip_address)) +print('=============================\n') + +# Listing mount targets is a paginated operation, so we can use the functionality in the oci.pagination +# module to get all the results +all_mount_targets = oci.pagination.list_call_get_all_results( + file_storage_client.list_mount_targets, + compartment_id, + availability_domain +) +print('All mount targets:\n{}'.format(all_mount_targets.data)) +print('=============================\n') + +# A mount target contains an export set, which we can use to link the mount target to the file system. We do this +# by creating an export that links the export set and the file system. Once we have an export, we can access the +# file system via the mount target and the file system can be mounted on, say, a compute instance. +# +# For more information on mounting file systems see: +# https://docs.us-phoenix-1.oraclecloud.com/Content/File/Tasks/mountingfilesystems.htm +create_response = file_storage_client.create_export( + oci.file_storage.models.CreateExportDetails( + export_set_id=mount_target.export_set_id, + file_system_id=file_system.id, + path='/files' + ), + retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY +) + +# We can list exports. This operation also takes optional filters so we can narrow this list down by file system +# or export set (mount target). +# Since listing is a paginated operation, we can use the functionality in oci.pagination +all_exports_by_file_system = oci.pagination.list_call_get_all_results( + file_storage_client.list_exports, + compartment_id, + file_system_id=file_system.id +) +print('All exports by file system:\n{}'.format(all_exports_by_file_system.data)) +print('=============================\n') +all_exports_by_export_set = oci.pagination.list_call_get_all_results( + file_storage_client.list_exports, + compartment_id, + export_set_id=mount_target.export_set_id +) +print('All exports by export set:\n{}'.format(all_exports_by_export_set.data)) +print('=============================\n') + +# We can also retrieve information on an export set itself +get_export_set_response = file_storage_client.get_export_set(mount_target.export_set_id) +print('Export set on mount target:\n{}'.format(get_export_set_response.data)) +print('=============================\n') + +# Exports have a lifecycle state, so we can wait on it to become available. Also, if we no longer need an export +# then we can delete it. +# +# When deleting, since the resource may be gone, we set succeed_on_not_found on the waiter so that we consider +# receiving a 404 back from the service as a successful delete +get_export_response = oci.wait_until( + file_storage_client, + file_storage_client.get_export(create_response.data.id), + 'lifecycle_state', + 'ACTIVE' +) +export = get_export_response.data +file_storage_client.delete_export(export.id) +oci.wait_until( + file_storage_client, + get_export_response, + 'lifecycle_state', + 'DELETED', + succeed_on_not_found=True +) +print('Deleted export: {}'.format(export.id)) +print('=============================\n') + +# We can create a point-in-time snapshot of a file system. Snapshots also have a lifecycle state, so we can wait on it +# to become available +# +# Note that snapshot names are immutable and must be unique amongst all non-DELETED snapshots for a file system. +create_snapshot_response = file_storage_client.create_snapshot( + oci.file_storage.models.CreateSnapshotDetails( + file_system_id=file_system.id, + name='my_snapshot_1' + ), + retry_strategy=oci.retry.DEFAULT_RETRY_STRATEGY +) + +# A snapshot also has a lifecycle state, so wait until it is active +get_snapshot_response = oci.wait_until( + file_storage_client, + file_storage_client.get_snapshot(create_snapshot_response.data.id), + 'lifecycle_state', + 'ACTIVE' +) +snapshot = get_snapshot_response.data +print('Created snapshot:\n{}'.format(snapshot)) +print('=============================\n') + +# We can list snapshots for a given file system. This is a paginated operation, so we can use the functions in +# oci.pagination +all_snapshots = oci.pagination.list_call_get_all_results( + file_storage_client.list_snapshots, + file_system.id +) +print('All snapshots for file system:\n{}'.format(all_snapshots.data)) +print('=============================\n') + +# We can also delete a snapshot and then wait for it to be deleted. The snapshot may already be deleted +# by the time we call wait_until, so pass the get_snapshot_response to the waiter. It is recommended that +# you have a get response prior to calling the delete, INSTEAD OF doing: +# +# oci.wait_until(file_storage_client, file_storage_client.get_snapshot(snapshot_id), ...) +file_storage_client.delete_snapshot(snapshot.id) +oci.wait_until( + file_storage_client, + get_snapshot_response, + 'lifecycle_state', + 'DELETED', + succeed_on_not_found=True +) +print('Deleted snapshot') + +# Once we are done with the mount target, we can delete it and then wait for it to be deleted. The mount target +# may already be deleted by the time we call wait_until, so do a get before the delete in order to have a response +# object to pass to the waiter +get_mount_target_response = file_storage_client.get_mount_target(mount_target.id) +file_storage_client.delete_mount_target(mount_target.id) +oci.wait_until( + file_storage_client, + get_mount_target_response, + 'lifecycle_state', + 'DELETED', + succeed_on_not_found=True +) +print('Deleted mount target') + +file_storage_client.delete_file_system(file_system.id) +oci.wait_until( + file_storage_client, + file_storage_client.get_file_system(file_system.id), + 'lifecycle_state', + 'DELETED', + succeed_on_not_found=True +) +print('Deleted file system') + +delete_vcn_and_subnet(virtual_network_client, vcn_and_subnet) +print('Deleted VCN and subnet') + +print('Script finished') diff --git a/examples/launch_db_system_example.py b/examples/launch_db_system_example.py new file mode 100644 index 0000000000..b4da24e108 --- /dev/null +++ b/examples/launch_db_system_example.py @@ -0,0 +1,284 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example of how to launch a DB system using the Python SDK. This script will: +# +# * Create a VCN and subnet for the DB system and its related resources +# * Launch a DB system containing a single DB home and database. See: +# https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm and +# https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Tasks/launchingDB.htm +# for more information +# * Demonstrate listing and retrieving information on individual DB systems, DB homes and databases +# * Demonstrate taking action on nodes +# +# Resources created by the script will be removed when the script is done. +# +# This script takes the following arguments: +# +# * The compartment which owns the DB system +# * The availability domain where the DB system will be launched +# * The CIDR block for the VCN and subnet (these will use the same CIDR) +# * The path to the public SSH key which can be used for SSHing into the DB system +# +# This script also makes assumptions on the following database parameters: +# +# * Core count +# * DB edition +# * DB version +# * Dummy password + +import oci +import os.path +import sys + +ADMIN_PASSWORD = "ADummyPassw0rd_#1" +DB_VERSION = '12.1.0.2' +DB_SYSTEM_CPU_CORE_COUNT = 4 +DB_SYSTEM_DB_EDITION = 'ENTERPRISE_EDITION' +DB_SYSTEM_SHAPE = 'BM.DenseIO1.36' + + +def create_vcn(virtual_network, compartment_id, cidr_block): + vcn_name = 'py_sdk_example_vcn' + result = virtual_network.create_vcn( + oci.core.models.CreateVcnDetails( + cidr_block=cidr_block, + display_name=vcn_name, + compartment_id=compartment_id, + dns_label='pysdkex' + ) + ) + get_vcn_response = oci.wait_until( + virtual_network, + virtual_network.get_vcn(result.data.id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Created VCN: {}'.format(get_vcn_response.data.id)) + + return get_vcn_response.data + + +def delete_vcn(virtual_network, vcn): + virtual_network.delete_vcn(vcn.id) + oci.wait_until( + virtual_network, + virtual_network.get_vcn(vcn.id), + 'lifecycle_state', + 'TERMINATED', + # For a deletion, the record may no longer be available and the waiter may encounter a 404 when trying to retrieve it. + # This flag tells the waiter to consider 404s as successful (which is only really valid for delete/terminate since + # the record not being there anymore can signify a successful delete/terminate) + succeed_on_not_found=True + ) + print('Deleted VCN: {}'.format(vcn.id)) + + +def create_subnet(virtual_network, vcn, availability_domain): + subnet_name = 'py_sdk_example_subnet1' + result = virtual_network.create_subnet( + oci.core.models.CreateSubnetDetails( + compartment_id=vcn.compartment_id, + availability_domain=availability_domain, + display_name=subnet_name, + vcn_id=vcn.id, + cidr_block=vcn.cidr_block, + dns_label='pysdksubex' + ) + ) + get_subnet_response = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Created Subnet: {}'.format(get_subnet_response.data.id)) + + return get_subnet_response.data + + +def delete_subnet(virtual_network, subnet): + virtual_network.delete_subnet(subnet.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet.id), + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True + ) + print('Deleted Subnet: {}'.format(subnet.id)) + + +def list_db_system_shapes(database_client, compartment_id): + # We can list the different database shapes available to us. This is a paginated operation so we can use the functions + # in oci.pagination to get all the results without having to manually deal with page tokens + list_db_shape_results = oci.pagination.list_call_get_all_results( + database_client.list_db_system_shapes, + availability_domain, + compartment_id + ) + + print('\nDB System Shapes') + print('===========================') + print('{}\n\n'.format(list_db_shape_results.data)) + + +def list_db_versions(database_client, compartment_id): + # We can list DB versions. This is a paginated operation so we can use the functions in oci.pagination to get + # all the results without having to manually deal with page tokens + list_db_version_results = oci.pagination.list_call_get_all_results( + database_client.list_db_versions, + compartment_id + ) + + print('\nDB Versions') + print('===========================') + print('{}\n\n'.format(list_db_version_results.data)) + + # We can do some additional filtering so that only versions compatible with a given shape are returned. Note + # the usage of the db_system_shape keword argument + list_db_version_results = oci.pagination.list_call_get_all_results( + database_client.list_db_versions, + compartment_id, + db_system_shape=DB_SYSTEM_SHAPE + ) + + print('\nDB Versions by shape: {}'.format(DB_SYSTEM_SHAPE)) + print('===========================') + print('{}\n\n'.format(list_db_version_results.data)) + + +def list_db_home_and_databases_under_db_system(database_client, compartment_id, db_system): + # A DB System contains DB Homes and the DB Homes contain databases. First, let's find the DB homes for the + # DB system by listing them. Listing is a paginated operation so we can use the functions in oci.pagination + # here + list_db_homes_response = oci.pagination.list_call_get_all_results( + database_client.list_db_homes, + compartment_id, + db_system.id + ) + print('\nDB Homes For DB System') + print('===========================') + print('{}\n\n'.format(list_db_homes_response.data)) + + # The results returned in the list operation are DbHomeSummary objects. We can also call get_db_home to fetch + # the full information about the DB home + db_home_summary = list_db_homes_response.data[0] + db_home = database_client.get_db_home(db_home_summary.id).data + print('\nGet DB Home') + print('===============') + print('{}\n\n'.format(db_home)) + + # DB Homes contain databases. We can find the databases in a DB home by listing them. This is a paginated + # operation so we can use the functions in oci.pagination here + list_databases_response = oci.pagination.list_call_get_all_results( + database_client.list_databases, + compartment_id, + db_home.id + ) + print('\nDatabases For DB Home') + print('===========================') + print('{}\n\n'.format(list_databases_response.data)) + + # The results returned in the list operation are DatabaseSummary objects. We can also call get_database to fetch + # the full information about the DB home + database_summary = list_databases_response.data[0] + database = database_client.get_database(database_summary.id).data + print('\nGet Database') + print('===============') + print('{}\n\n'.format(database)) + + +if len(sys.argv) != 5: + raise RuntimeError('Invalid number of arguments provided to the script. Consult the script header for required arguments') + +compartment_id = sys.argv[1] +availability_domain = sys.argv[2] +cidr_block = sys.argv[3] +ssh_public_key_path = os.path.expandvars(os.path.expanduser(sys.argv[4])) + +# Default config file and profile +config = oci.config.from_file() +database_client = oci.database.DatabaseClient(config) +virtual_network_client = oci.core.VirtualNetworkClient(config) + +list_db_system_shapes(database_client, compartment_id) +list_db_versions(database_client, compartment_id) + +vcn = None +subnet = None +try: + vcn = create_vcn(virtual_network_client, compartment_id, cidr_block) + subnet = create_subnet(virtual_network_client, vcn, availability_domain) + + with open(ssh_public_key_path, mode='r') as file: + ssh_key = file.read() + + launch_db_system_details = oci.database.models.LaunchDbSystemDetails( + availability_domain=availability_domain, + compartment_id=compartment_id, + cpu_core_count=DB_SYSTEM_CPU_CORE_COUNT, + database_edition=DB_SYSTEM_DB_EDITION, + db_home=oci.database.models.CreateDbHomeDetails( + db_version=DB_VERSION, + display_name='py sdk example db home', + database=oci.database.models.CreateDatabaseDetails( + admin_password=ADMIN_PASSWORD, + db_name='testdb' + ) + ), + display_name='testdb', + hostname='pysdk-example-db-host', + shape=DB_SYSTEM_SHAPE, + ssh_public_keys=[ssh_key], + subnet_id=subnet.id + ) + + launch_response = database_client.launch_db_system(launch_db_system_details) + print('\nLaunched DB System') + print('===========================') + print('{}\n\n'.format(launch_response.data)) + + # We can wait until the DB system is available. A DB system can take some time to launch (e.g. on the order + # of magnitude of hours) so we can change the max_interval_seconds and max_wait_seconds to account for this. + # The wait_until defaults of checking every 30 seconds and waiting for a maximum of 1200 seconds (20 minutes) + # may not be sufficient. + # + # In the below example, we check every 900 seconds (15 minutes) and wait a max of 21600 seconds (6 hours) + get_db_system_response = oci.wait_until( + database_client, + database_client.get_db_system(launch_response.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_interval_seconds=900, + max_wait_seconds=21600 + ) + + print('\nDB System Available') + print('===========================') + print('{}\n\n'.format(get_db_system_response.data)) + + list_db_home_and_databases_under_db_system(database_client, compartment_id, get_db_system_response.data) + + # Once we're done with the DB system, we can terminate it and wait for it to be terminated. We also use + # succeed_on_not_found for the waiter in case the DB system is no longer returned by get_db_system calls + # as that implies our delete/termination has succeeded. + # + # In this basic scenario where we have a single DB system, DB home and database, terminating the DB system + # will also delete the DB home and database. + get_db_system_response = database_client.get_db_system(launch_response.data.id) + database_client.terminate_db_system(get_db_system_response.data.id) + oci.wait_until( + database_client, + get_db_system_response, + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True + ) + print('Terminated DB system') +finally: + if subnet: + delete_subnet(virtual_network_client, subnet) + + if vcn: + delete_vcn(virtual_network_client, vcn) diff --git a/examples/launch_instance_example.py b/examples/launch_instance_example.py new file mode 100644 index 0000000000..bd0d904d41 --- /dev/null +++ b/examples/launch_instance_example.py @@ -0,0 +1,334 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example of how to launch an instance using the Python SDK. This script will: +# +# * Create a VCN, subnet and internet gateway. This will enable the instance to connect to the public internet. +# If this is not desired then the internet gateway (and associated route rule) don't need to be created. +# * Launch an instance. Certain assumptions are made about launching the instance +# - The instance launched will have a shape of VM.Standard1.1 +# - The instance launched will use an Oracle Linux 7.4 image +# +# Resources created by the script will be removed when the script is done. +# +# This script takes the following arguments: +# +# * The display name for the instance +# * The compartment which owns the instance +# * The availability domain where the instance will be launched +# * The CIDR block for the VCN and subnet (these will use the same CIDR) +# * The path to the public SSH key which can be used for SSHing into the instance + +import oci +import os.path +import sys + + +def create_vcn(virtual_network, compartment_id, cidr_block): + vcn_name = 'py_sdk_example_vcn' + result = virtual_network.create_vcn( + oci.core.models.CreateVcnDetails( + cidr_block=cidr_block, + display_name=vcn_name, + compartment_id=compartment_id + ) + ) + get_vcn_response = oci.wait_until( + virtual_network, + virtual_network.get_vcn(result.data.id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Created VCN: {}'.format(get_vcn_response.data.id)) + + return get_vcn_response.data + + +def delete_vcn(virtual_network, vcn): + virtual_network.delete_vcn(vcn.id) + oci.wait_until( + virtual_network, + virtual_network.get_vcn(vcn.id), + 'lifecycle_state', + 'TERMINATED', + # For a deletion, the record may no longer be available and the waiter may encounter a 404 when trying to retrieve it. + # This flag tells the waiter to consider 404s as successful (which is only really valid for delete/terminate since + # the record not being there anymore can signify a successful delete/terminate) + succeed_on_not_found=True + ) + print('Deleted VCN: {}'.format(vcn.id)) + + +def create_subnet(virtual_network, vcn, availability_domain): + subnet_name = 'py_sdk_example_subnet1' + result = virtual_network.create_subnet( + oci.core.models.CreateSubnetDetails( + compartment_id=vcn.compartment_id, + availability_domain=availability_domain, + display_name=subnet_name, + vcn_id=vcn.id, + cidr_block=vcn.cidr_block + ) + ) + get_subnet_response = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Created Subnet: {}'.format(get_subnet_response.data.id)) + + return get_subnet_response.data + + +def delete_subnet(virtual_network, subnet): + virtual_network.delete_subnet(subnet.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet.id), + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True + ) + print('Deleted Subnet: {}'.format(subnet.id)) + + +def create_internet_gateway(virtual_network, vcn): + internet_gateway_name = 'py_sdk_example_ig' + result = virtual_network.create_internet_gateway( + oci.core.models.CreateInternetGatewayDetails( + display_name=internet_gateway_name, + compartment_id=vcn.compartment_id, + is_enabled=True, + vcn_id=vcn.id + ) + ) + get_internet_gateway_response = oci.wait_until( + virtual_network, + virtual_network.get_internet_gateway(result.data.id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Created internet gateway: {}'.format(get_internet_gateway_response.data.id)) + + add_route_rule_to_default_route_table_for_internet_gateway( + virtual_network, + vcn, + get_internet_gateway_response.data + ) + + return get_internet_gateway_response.data + + +def delete_internet_gateway(virtual_network, internet_gateway): + virtual_network.delete_internet_gateway(internet_gateway.id) + oci.wait_until( + virtual_network, + virtual_network.get_internet_gateway(internet_gateway.id), + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True + ) + print('Deleted Internet Gateway: {}'.format(internet_gateway.id)) + + +# This makes sure that we use the internet gateway for accessing the internet. See: +# https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIGs.htm +# for more information. +# +# As a convenience, we'll add a route rule to the default route table. However, in your +# own code you may opt to use a different route table +def add_route_rule_to_default_route_table_for_internet_gateway(virtual_network, vcn, internet_gateway): + get_route_table_response = virtual_network.get_route_table(vcn.default_route_table_id) + route_rules = get_route_table_response.data.route_rules + + print('\nCurrent Route Rules For VCN') + print('===========================') + print('{}\n\n'.format(route_rules)) + + # Updating route rules will totally replace any current route rules with what we send through. + # If we wish to preserve any existing route rules, we need to read them out first and then send + # them back to the service as part of any update + route_rules.append( + oci.core.models.RouteRule( + cidr_block='0.0.0.0/0', + network_entity_id=internet_gateway.id + ) + ) + + virtual_network.update_route_table( + vcn.default_route_table_id, + oci.core.models.UpdateRouteTableDetails(route_rules=route_rules) + ) + + get_route_table_response = oci.wait_until( + virtual_network, + virtual_network.get_route_table(vcn.default_route_table_id), + 'lifecycle_state', + 'AVAILABLE' + ) + + print('\nUpdated Route Rules For VCN') + print('===========================') + print('{}\n\n'.format(get_route_table_response.data.route_rules)) + + return get_route_table_response.data + + +def clear_route_rules_from_default_route_table(virtual_network, vcn): + virtual_network.update_route_table( + vcn.default_route_table_id, + oci.core.models.UpdateRouteTableDetails(route_rules=[]) + ) + oci.wait_until( + virtual_network, + virtual_network.get_route_table(vcn.default_route_table_id), + 'lifecycle_state', + 'AVAILABLE' + ) + print('Cleared route rules from route table: {}'.format(vcn.default_route_table_id)) + + +def get_image(compute, operating_system, operating_system_version, shape): + # Listing images is a paginated call, so we can use the oci.pagination module to get all results + # without having to manually handle page tokens + # + # In this case, we want to find the image for the OS and version we want to run, and which can + # be used for the shape of instance we want to launch + list_images_response = oci.pagination.list_call_get_all_results( + compute.list_images, + compartment_id, + operating_system=operating_system, + operating_system_version=operating_system_version, + shape=shape + ) + + # For demonstration, we just return the first image but for Production code you should have a better + # way of determining what is needed + return list_images_response.data[0] + + +if len(sys.argv) != 6: + raise RuntimeError('Invalid number of arguments provided to the script. Consult the script header for required arguments') + +instance_display_name = sys.argv[1] +compartment_id = sys.argv[2] +availability_domain = sys.argv[3] +cidr_block = sys.argv[4] +ssh_public_key_path = os.path.expandvars(os.path.expanduser(sys.argv[5])) + +# Default config file and profile +config = oci.config.from_file() +compute_client = oci.core.ComputeClient(config) +virtual_network_client = oci.core.VirtualNetworkClient(config) + +vcn = None +subnet = None +internet_gateway = None +try: + vcn = create_vcn(virtual_network_client, compartment_id, cidr_block) + subnet = create_subnet(virtual_network_client, vcn, availability_domain) + internet_gateway = create_internet_gateway(virtual_network_client, vcn) + + image = get_image(compute_client, 'Oracle Linux', '7.4', 'VM.Standard1.1') + + with open(ssh_public_key_path, mode='r') as file: + ssh_key = file.read() + + # We can use instance metadata to specify the SSH keys to be included in the + # ~/.ssh/authorized_keys file for the default user on the instance via the special "ssh_authorized_keys" key. + # + # We can also provide arbitrary string keys and string values. If you are providing these, you should consider + # whether defined and freeform tags on an instance would better meet your use case. See: + # https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/taggingoverview.htm for more information + # on tagging + instance_metadata = { + 'ssh_authorized_keys': ssh_key, + 'some_metadata_item': 'some item value' + } + + # Extended metadata differs from normal metadata in that it can support nested maps/dicts. If you are providing + # these, you should consider whether defined and freeform tags on an instance would better meet your use case. + instance_extended_metadata = { + 'string_key_1': 'string_value_1', + 'map_key_1': { + 'string_key_2': 'string_value_2', + 'map_key_2': { + 'string_key_3': 'string_value_3' + }, + 'empty_map_key': {} + } + } + + launch_instance_details = oci.core.models.LaunchInstanceDetails( + display_name=instance_display_name, + compartment_id=compartment_id, + availability_domain=availability_domain, + shape='VM.Standard1.1', + metadata=instance_metadata, + extended_metadata=instance_extended_metadata, + source_details=oci.core.models.InstanceSourceViaImageDetails(image_id=image.id), + create_vnic_details=oci.core.models.CreateVnicDetails( + subnet_id=subnet.id + ) + ) + + launch_instance_response = compute_client.launch_instance(launch_instance_details) + + print('\nLaunched instance') + print('===========================') + print('{}\n\n'.format(launch_instance_response.data)) + + get_instance_response = oci.wait_until( + compute_client, + compute_client.get_instance(launch_instance_response.data.id), + 'lifecycle_state', + 'RUNNING' + ) + + print('\nRunning instance') + print('===========================') + print('{}\n\n'.format(get_instance_response.data)) + + # We can find the private and public IP address of the instance by getting information on its VNIC(s). This + # relationship is indirect, via the VnicAttachments of an instance + + # Note that listing VNIC attachments is a paginated operation so we can use the oci.pagination module to avoid + # having to manually deal with page tokens. + # + # Since we're only interested in our specific instance, we can pass that as a filter to the list operation + list_vnic_attachments_response = oci.pagination.list_call_get_all_results( + compute_client.list_vnic_attachments, + compartment_id, + instance_id=get_instance_response.data.id + ) + + vnic = virtual_network_client.get_vnic(list_vnic_attachments_response.data[0].vnic_id).data + print('\nInstance IP Addresses') + print('===========================') + print('Private IP: {}'.format(vnic.private_ip)) + print('Public IP: {}\n\n'.format(vnic.public_ip)) + + # Once we're done with the instance, we can terminate it and wait for it to be terminated. We also use + # succeed_on_not_found for the waiter in case the instance is no longer returned by get_instance calls + # as that implies our delete/termination has succeeded + compute_client.terminate_instance(get_instance_response.data.id) + oci.wait_until( + compute_client, + compute_client.get_instance(get_instance_response.data.id), + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True + ) +finally: + if internet_gateway: + # Because the internet gateway is referenced by a route rule, the rule needs to be deleted before + # we can remove the internet gateway + clear_route_rules_from_default_route_table(virtual_network_client, vcn) + delete_internet_gateway(virtual_network_client, internet_gateway) + + if subnet: + delete_subnet(virtual_network_client, subnet) + + if vcn: + delete_vcn(virtual_network_client, vcn) diff --git a/examples/object_storage_archive_example.py b/examples/object_storage_archive_example.py new file mode 100644 index 0000000000..a3d3a80c4c --- /dev/null +++ b/examples/object_storage_archive_example.py @@ -0,0 +1,107 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example of how to use archive storage in the Object Storage service. This example +# will create an archive storage bucket and demonstrate putting and restoring objects. +# This script accepts two arguments: +# +# * The first argument is the OCID of the compartment where we'll create a bucket +# * The second is the name of bucket to create + +import oci +import sys + + +if len(sys.argv) != 3: + raise RuntimeError('This script expects an argument of a compartment OCID where the bucket will be created, and the name of the bucket') + +# The first argument is the name of the script, so start the index at 1 +compartment_id = sys.argv[1] +bucket_name = sys.argv[2] + +# Default config file and profile +config = oci.config.from_file() +object_storage_client = oci.object_storage.ObjectStorageClient(config) + +namespace = object_storage_client.get_namespace().data + +create_bucket_response = object_storage_client.create_bucket( + namespace, + oci.object_storage.models.CreateBucketDetails( + name=bucket_name, + compartment_id=compartment_id, + storage_tier='Archive', + public_access_type='ObjectRead' + ) +) +print('Created archive storage bucket:\n{}'.format(create_bucket_response.data)) +print('\n=========================\n') + +# We use the same operation to put an object in a bucket, regardless of its storage tier. Note that the response +# does not contain a body but the headers will contain information about the object, such as its ETag and MD5 +object_name = 'archive_object_test' +put_object_response = object_storage_client.put_object(namespace, bucket_name, object_name, 'Test object content') +print('Put object into archive storage bucket:\n{}'.format(create_bucket_response.headers)) +print('\n=========================\n') + +# If an object is archived, then we cannot do a get_object. This will throw an exception with a HTTP 409 status +# and a code of NotRestored +try: + object_storage_client.get_object(namespace, bucket_name, object_name) +except oci.exceptions.ServiceError as e: + print('Attempt to get archived object:\n{}'.format(e)) + print('\n=========================\n') + + +# We can, however, HEAD the object to get its current status. The response will not have a body, but the headers +# will contain information. One key header of interest is archival-state. In this case, because we have only +# put the object in the bucket, it will start out as "Archived". +# +# See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Object/HeadObject for +# more information on available headers +head_object_response = object_storage_client.head_object(namespace, bucket_name, object_name) +print('Archive state from head_object: {}'.format(head_object_response.headers['archival-state'])) +print('All headers:\n{}'.format(head_object_response.headers)) +print('\n=========================\n') + + +# We can restore an object in archive storage (so that the GetObject will work) by using the restore_objects +# operation. In RestoreObjectsDetails, the hours field represents how long after restoration has completed that +# the object will be available for before being archived again. If no value is specified, +# this will default to 24 hours +object_storage_client.restore_objects( + namespace, + bucket_name, + oci.object_storage.models.RestoreObjectsDetails( + object_name=object_name, + hours=72 + ) +) + +# Objects take some time to restore. During that time get_object will still throw an exception +# with a HTTP 409 status and a code of NotRestored +try: + object_storage_client.get_object(namespace, bucket_name, object_name) +except oci.exceptions.ServiceError as e: + print('Attempt to get a restoring object:\n{}'.format(e)) + print('\n=========================\n') + +# We can use head_object to check/poll the status of the object. The headers of interest are archival-state +# and time-of-archival. While the object is restoring, archival-state will be "Restoring" and when +# it is "Restored" then a get_object can be done successfully. +# +# For a restored object, the time-of-archival will be when the object will be archived again. +# +# See https://docs.us-phoenix-1.oraclecloud.com/api/#/en/objectstorage/20160918/Object/HeadObject for +# more information on available headers +head_object_response = object_storage_client.head_object(namespace, bucket_name, object_name) +print('Archive state from head_object: {}'.format(head_object_response.headers['archival-state'])) +print('All headers:\n{}'.format(head_object_response.headers)) +print('\n=========================\n') + +# Clean up +object_storage_client.delete_object(namespace, bucket_name, object_name) +print('Deleted object') + +object_storage_client.delete_bucket(namespace, bucket_name) +print('Deleted bucket') diff --git a/examples/object_storage_bucket_tagging_example.py b/examples/object_storage_bucket_tagging_example.py new file mode 100644 index 0000000000..bd627bf75e --- /dev/null +++ b/examples/object_storage_bucket_tagging_example.py @@ -0,0 +1,113 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example of how to tag buckets in Object Storage. +# This script accepts four arguments: +# +# * The first argument is the OCID of the compartment where we'll create a bucket +# * The second is the name of bucket to create +# * The third is the name (not OCID) of the tag namespace to use in defined tags +# * The fourth is the name of a tag in the tag namespace to use defined tags + +import oci +import sys + +if len(sys.argv) != 5: + raise RuntimeError('Unexpected number of arguments received. Consult the script header comments for expected arguments') + +compartment_id = sys.argv[1] +bucket_name = sys.argv[2] +tag_namespace = sys.argv[3] +tag_name = sys.argv[4] + +# Default config file and profile +config = oci.config.from_file() +object_storage_client = oci.object_storage.ObjectStorageClient(config) + +namespace = object_storage_client.get_namespace().data + +# We can assign tags to a bucket at creation time. Like other taggable resources, we can +# assign freeform and defined tags to a bucket. Freeform tags are a dictionary of +# string-to-string, where the key is the tag name and the value is the tag value. +# +# Defined tags are a dictionary where the key is the tag namespace (string) and the value is another dictionary. In +# this second dictionary, the key is the tag name (string) and the value is the tag value. The tag names have to +# correspond to the name of a tag within the specified namespace (and the namespace must exist). +create_bucket_response = object_storage_client.create_bucket( + namespace, + oci.object_storage.models.CreateBucketDetails( + name=bucket_name, + compartment_id=compartment_id, + public_access_type='ObjectRead', + freeform_tags={'free': 'form', 'another': 'item'}, + defined_tags={tag_namespace: {tag_name: 'value at create'}} + ) +) +print('Created a bucket with tags:\n{}'.format(create_bucket_response.data)) +print('\n=========================\n') + +# Tags come back when retrieving the bucket +get_bucket_response = object_storage_client.get_bucket(namespace, bucket_name) +print('Retrieved bucket with tags:\n{}'.format(get_bucket_response.data)) +print('\n=========================\n') + +# Unlike other resources (e.g. instances, VCNs, and block volumes), when listing buckets +# tags are not returned by default. Instead, you need to provide a value to the fields +# parameter when listing buckets in order to have those tags returned. +# +# Here we can see the result of providing and not providing that parameter. +list_buckets_without_asking_for_tags_generator = oci.pagination.list_call_get_all_results_generator( + object_storage_client.list_buckets, + 'record', + namespace, + compartment_id +) +for bucket in list_buckets_without_asking_for_tags_generator: + if bucket.name == bucket_name: + print('Bucket summary without tags:\n{}'.format(bucket)) + print('\n=========================\n') + break + +list_buckets_asking_for_tags_generator = oci.pagination.list_call_get_all_results_generator( + object_storage_client.list_buckets, + 'record', + namespace, + compartment_id, + fields=['tags'] +) +for bucket in list_buckets_asking_for_tags_generator: + if bucket.name == bucket_name: + print('Bucket summary with tags:\n{}'.format(bucket)) + print('\n=========================\n') + break + +# We can also update tags on a bucket. Note that this is a total replacement for any +# previously set freeform or defined tags. +update_bucket_response = object_storage_client.update_bucket( + namespace, + bucket_name, + oci.object_storage.models.UpdateBucketDetails( + name=bucket_name, + freeform_tags={'new': 'freeform'}, + defined_tags={tag_namespace: {tag_name: 'replaced'}} + ) +) +print('Updated a bucket with new tags:\n{}'.format(update_bucket_response.data)) +print('\n=========================\n') + +# We can also clear tags from a bucket by passing empty dicts to the tag parameters +update_bucket_response = object_storage_client.update_bucket( + namespace, + bucket_name, + oci.object_storage.models.UpdateBucketDetails( + name=bucket_name, + freeform_tags={}, + defined_tags={} + ) +) +print('Cleared tags on the bucket:\n{}'.format(update_bucket_response.data)) +print('\n=========================\n') + +# Clean up +object_storage_client.delete_bucket(namespace, bucket_name) +print('Deleted bucket') diff --git a/examples/pagination.py b/examples/pagination.py index f434a465c8..bb14b75b09 100644 --- a/examples/pagination.py +++ b/examples/pagination.py @@ -7,6 +7,7 @@ # - Eagerly loading all results from a list call up to a given limit # - Generators that can be used to lazily iterate over results from a list call. These generators can yield either values/models # or the raw responses of the call +# - Pagination using raw responses instead of the oci.pagination module import oci @@ -78,3 +79,14 @@ total_results += 1 print('Response: {}, User: {}'.format(response_num, user.name)) print('Total results: {}'.format(total_results)) + +print('--------------------------------------------') +print('Pagination using raw responses') +print('--------------------------------------------') +response = identity.list_users(compartment_id) +users = response.data +while response.has_next_page: + response = identity.list_users(compartment_id, page=response.next_page) + users.extend(response.data) +for u in users: + print('User: {}'.format(u.name)) diff --git a/src/oci/__init__.py b/src/oci/__init__.py index b2f2af3852..238b404966 100644 --- a/src/oci/__init__.py +++ b/src/oci/__init__.py @@ -1,7 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -from . import audit, core, database, dns, identity, load_balancer, object_storage +from . import audit, core, database, dns, file_storage, identity, load_balancer, object_storage from . import auth, config, constants, decorators, exceptions, regions, pagination, retry from .base_client import BaseClient from .request import Request @@ -13,5 +13,5 @@ __all__ = [ "BaseClient", "Error", "Request", "Response", "Signer", "config", "constants", "decorators", "exceptions", "regions", "wait_until", "pagination", "auth", "retry", - "audit", "core", "database", "dns", "identity", "load_balancer", "object_storage" + "audit", "core", "database", "dns", "file_storage", "identity", "load_balancer", "object_storage" ] diff --git a/src/oci/base_client.py b/src/oci/base_client.py index 8f8ec82513..27107791ab 100644 --- a/src/oci/base_client.py +++ b/src/oci/base_client.py @@ -52,6 +52,20 @@ def build_user_agent(extra=""): STREAM_RESPONSE_TYPE = 'stream' BYTES_RESPONSE_TYPE = 'bytes' +# The keys here correspond to the Swagger collection format values described here: https://swagger.io/docs/specification/2-0/describing-parameters/ +# and the values represent delimiters we'll use between values of the collection when placing those values in the query string. +# +# Note that the 'multi' type has no delimiter since in the query string we'll want to repeat the same query string param key but +# with different values each time (e.g. myKey=val1&myKey=val2), whereas for the other types we will only pass in a single +# key=value in the query string, where the "value" is the members of the collecction with a given delimiter. +VALID_COLLECTION_FORMAT_TYPES = { + 'multi': None, + 'csv': ',', + 'tsv': '\t', + 'ssv': ' ', + 'pipes': '|' +} + class BaseClient(object): primitive_type_map = { @@ -170,27 +184,52 @@ def call_api(self, resource_path, method, else: raise + def generate_collection_format_param(self, param_value, collection_format_type): + if param_value is missing: + return missing + + if collection_format_type not in VALID_COLLECTION_FORMAT_TYPES: + raise ValueError('Invalid collection format type {}. Valid types are: {}'.format(collection_format_type, list(VALID_COLLECTION_FORMAT_TYPES.keys()))) + + if collection_format_type == 'multi': + return param_value + else: + return VALID_COLLECTION_FORMAT_TYPES[collection_format_type].join(param_value) + def process_query_params(self, query_params): query_params = self.sanitize_for_serialization(query_params) processed_query_params = {} for k, v in query_params.items(): - # First divide our query params into ones where the param value is and isn't a dict. Since we're executing after sanitize_for_serialization has been called - # it's dicts, lists or primitives all the way down. The params where the value is a dict are, for example, tags we need to handle differently for inclusion - # in the query string. An example query_params is: + # First divide our query params into ones where the param value is "simple" (not a dict or list), a list or a dict. Since we're + # executing after sanitize_for_serialization has been called it's dicts, lists or primitives all the way down. + # + # The params where the value is a dict are, for example, tags we need to handle differently for inclusion + # in the query string. + # + # The params where the value is a list are multivalued parameters in the query string. + # + # An example query_params is: # # { # "stuff": "things", + # "collectionFormat": ["val1", "val2", "val3"] # "definedTags": { "tag1": ["val1", "val2", "val3"], "tag2": ["val1"] }, # "definedTagsExists": { "tag3": True, "tag4": True } # } # # And we can categorize the params as: # - # Non-Dict: "stuff":"things" + # Simple: "stuff":"things" + # List: "collectionFormat": ["val1", "val2", "val3"] # Dict: "definedTags": { "tag1": ["val1", "val2", "val3"], "tag2": ["val1"] }, "definedTagsExists": { "tag3": True, "tag4": True } - if not isinstance(v, dict): + if not isinstance(v, dict) and not isinstance(v, list): processed_query_params[k] = self.to_path_value(v) + elif isinstance(v, list): + # The requests library supports lists to represent multivalued params natively + # (http://docs.python-requests.org/en/master/api/#requests.Session.params) so we just have to assign + # the list to the key (where the key is the query string param key) + processed_query_params[k] = v else: # If we are here then we either have: # diff --git a/src/oci/database/database_client.py b/src/oci/database/database_client.py index 61a7a03e6b..ed0c2923fe 100644 --- a/src/oci/database/database_client.py +++ b/src/oci/database/database_client.py @@ -98,11 +98,11 @@ def create_data_guard_association(self, database_id, create_data_guard_associati All Oracle Cloud Infrastructure resources, including Data Guard associations, get an Oracle-assigned, unique ID called an Oracle Cloud Identifier (OCID). When you create a resource, you can find its OCID in the response. You can also retrieve a resource's OCID by using a List API operation on that resource type, or by viewing the - resource in the Console. Fore more information, see + resource in the Console. For more information, see `Resource Identifiers`__. __ https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Tasks/usingdataguard.htm - __ http://localhost:8000/Content/General/Concepts/identifiers.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm :param str database_id: (required) diff --git a/src/oci/file_storage/__init__.py b/src/oci/file_storage/__init__.py new file mode 100644 index 0000000000..761e40baad --- /dev/null +++ b/src/oci/file_storage/__init__.py @@ -0,0 +1,10 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + + +from .file_storage_client import FileStorageClient +from . import models + +__all__ = ["FileStorageClient", "models"] diff --git a/src/oci/file_storage/file_storage_client.py b/src/oci/file_storage/file_storage_client.py new file mode 100644 index 0000000000..32e0072e69 --- /dev/null +++ b/src/oci/file_storage/file_storage_client.py @@ -0,0 +1,1661 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + +import requests # noqa: F401 +import six + +from .. import retry # noqa: F401 +from ..base_client import BaseClient +from ..config import get_config_value_or_default, validate_config +from ..signer import Signer +from ..util import Sentinel +from .models import file_storage_type_mapping +missing = Sentinel("Missing") + + +class FileStorageClient(object): + + def __init__(self, config, **kwargs): + validate_config(config, signer=kwargs.get('signer')) + if 'signer' in kwargs: + signer = kwargs['signer'] + else: + signer = Signer( + tenancy=config["tenancy"], + user=config["user"], + fingerprint=config["fingerprint"], + private_key_file_location=config.get("key_file"), + pass_phrase=get_config_value_or_default(config, "pass_phrase"), + private_key_content=config.get("key_content") + ) + self.base_client = BaseClient("file_storage", config, signer, file_storage_type_mapping) + + def create_export(self, create_export_details, **kwargs): + """ + CreateExport + Creates a new export in the specified export set, path, and + file system. + + + :param CreateExportDetails create_export_details: (required) + Details for creating a new export. + + :param str opc_retry_token: (optional) + A token that uniquely identifies a request so it can be retried in case of a timeout or + server error without risk of executing that same action again. Retry tokens expire after 24 + hours, but can be invalidated before then due to conflicting operations. For example, if a resource + has been deleted and purged from the system, then a retry of the original creation request + might be rejected. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.Export` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exports" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_export got unknown kwargs: {!r}".format(extra_kwargs)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-retry-token": kwargs.get("opc_retry_token", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_export_details, + response_type="Export") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_export_details, + response_type="Export") + + def create_file_system(self, create_file_system_details, **kwargs): + """ + CreateFileSystem + Creates a new file system in the specified compartment and + availability domain. Instances can mount file systems in + another availability domain, but doing so might increase + latency when compared to mounting instances in the same + availability domain. + + After you create a file system, you can associate it with a mount + target. Instances can then mount the file system by connecting to the + mount target's IP address. You can associate a file system with + more than one mount target at a time. + + For information about access control and compartments, see + `Overview of the IAM Service`__. + + For information about availability domains, see `Regions and + Availability Domains`__. + To get a list of availability domains, use the + `ListAvailabilityDomains` operation in the Identity and Access + Management Service API. + + All Oracle Cloud Infrastructure resources, including + file systems, get an Oracle-assigned, unique ID called an Oracle + Cloud Identifier (OCID). When you create a resource, you can + find its OCID in the response. You can also retrieve a + resource's OCID by using a List API operation on that resource + type or by viewing the resource in the Console. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm + + + :param CreateFileSystemDetails create_file_system_details: (required) + Details for creating a new file system. + + :param str opc_retry_token: (optional) + A token that uniquely identifies a request so it can be retried in case of a timeout or + server error without risk of executing that same action again. Retry tokens expire after 24 + hours, but can be invalidated before then due to conflicting operations. For example, if a resource + has been deleted and purged from the system, then a retry of the original creation request + might be rejected. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.FileSystem` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/fileSystems" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_file_system got unknown kwargs: {!r}".format(extra_kwargs)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-retry-token": kwargs.get("opc_retry_token", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_file_system_details, + response_type="FileSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_file_system_details, + response_type="FileSystem") + + def create_mount_target(self, create_mount_target_details, **kwargs): + """ + CreateMountTarget + Creates a new mount target in the specified compartment and + subnet. You can associate a file system with a mount + target only when they exist in the same availability domain. Instances + can connect to mount targets in another availablity domain, but + you might see higher latency than with instances in the same + availability domain as the mount target. + + Mount targets have one or more private IP addresses that you can + provide as the host portion of remote target parameters in + client mount commands. These private IP addresses are listed + in the privateIpIds property of the mount target and are highly available. Mount + targets also consume additional IP addresses in their subnet. + + For information about access control and compartments, see + `Overview of the IAM + Service`__. + + For information about availability domains, see `Regions and + Availability Domains`__. + To get a list of availability domains, use the + `ListAvailabilityDomains` operation in the Identity and Access + Management Service API. + + All Oracle Cloud Infrastructure Services resources, including + mount targets, get an Oracle-assigned, unique ID called an + Oracle Cloud Identifier (OCID). When you create a resource, + you can find its OCID in the response. You can also retrieve a + resource's OCID by using a List API operation on that resource + type, or by viewing the resource in the Console. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/overview.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm + + + :param CreateMountTargetDetails create_mount_target_details: (required) + Details for creating a new mount target. + + :param str opc_retry_token: (optional) + A token that uniquely identifies a request so it can be retried in case of a timeout or + server error without risk of executing that same action again. Retry tokens expire after 24 + hours, but can be invalidated before then due to conflicting operations. For example, if a resource + has been deleted and purged from the system, then a retry of the original creation request + might be rejected. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.MountTarget` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/mountTargets" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_mount_target got unknown kwargs: {!r}".format(extra_kwargs)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-retry-token": kwargs.get("opc_retry_token", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_mount_target_details, + response_type="MountTarget") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_mount_target_details, + response_type="MountTarget") + + def create_snapshot(self, create_snapshot_details, **kwargs): + """ + CreateSnapshot + Creates a new snapshot of the specified file system. You + can access the snapshot at `.snapshot/`. + + + :param CreateSnapshotDetails create_snapshot_details: (required) + Details for creating a new snapshot. + + :param str opc_retry_token: (optional) + A token that uniquely identifies a request so it can be retried in case of a timeout or + server error without risk of executing that same action again. Retry tokens expire after 24 + hours, but can be invalidated before then due to conflicting operations. For example, if a resource + has been deleted and purged from the system, then a retry of the original creation request + might be rejected. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.Snapshot` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/snapshots" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_snapshot got unknown kwargs: {!r}".format(extra_kwargs)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "opc-retry-token": kwargs.get("opc_retry_token", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + if not isinstance(kwargs['retry_strategy'], retry.NoneRetryStrategy): + self.base_client.add_opc_retry_token_if_needed(header_params) + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_snapshot_details, + response_type="Snapshot") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_snapshot_details, + response_type="Snapshot") + + def delete_export(self, export_id, **kwargs): + """ + DeleteExport + Deletes the specified export. + + + :param str export_id: (required) + The OCID of the export. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exports/{exportId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_export got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "exportId": export_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + + def delete_file_system(self, file_system_id, **kwargs): + """ + DeleteFileSystem + Deletes the specified file system. Before you delete the file system, + verify that no remaining export resources still reference it. Deleting a + file system also deletes all of its snapshots. + + + :param str file_system_id: (required) + The OCID of the file system. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/fileSystems/{fileSystemId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_file_system got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "fileSystemId": file_system_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + + def delete_mount_target(self, mount_target_id, **kwargs): + """ + DeleteMountTarget + Deletes the specified mount target. This operation also deletes the + mount target's VNICs. + + + :param str mount_target_id: (required) + The OCID of the mount target. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/mountTargets/{mountTargetId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_mount_target got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "mountTargetId": mount_target_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + + def delete_snapshot(self, snapshot_id, **kwargs): + """ + DeleteSnapshot + Deletes the specified snapshot. + + + :param str snapshot_id: (required) + The OCID of the snapshot. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/snapshots/{snapshotId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_snapshot got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "snapshotId": snapshot_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params) + + def get_export(self, export_id, **kwargs): + """ + GetExport + Gets the specified export's information. + + + :param str export_id: (required) + The OCID of the export. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.Export` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exports/{exportId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_export got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "exportId": export_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Export") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Export") + + def get_export_set(self, export_set_id, **kwargs): + """ + GetExportSet + Gets the specified export set's information. + + + :param str export_set_id: (required) + The OCID of the export set. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.ExportSet` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exportSets/{exportSetId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_export_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "exportSetId": export_set_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="ExportSet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="ExportSet") + + def get_file_system(self, file_system_id, **kwargs): + """ + GetFileSystem + Gets the specified file system's information. + + + :param str file_system_id: (required) + The OCID of the file system. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.FileSystem` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/fileSystems/{fileSystemId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_file_system got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "fileSystemId": file_system_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="FileSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="FileSystem") + + def get_mount_target(self, mount_target_id, **kwargs): + """ + GetMountTarget + Gets the specified mount target's information. + + + :param str mount_target_id: (required) + The OCID of the mount target. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.MountTarget` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/mountTargets/{mountTargetId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_mount_target got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "mountTargetId": mount_target_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="MountTarget") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="MountTarget") + + def get_snapshot(self, snapshot_id, **kwargs): + """ + GetSnapshot + Gets the specified snapshot's information. + + + :param str snapshot_id: (required) + The OCID of the snapshot. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.Snapshot` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/snapshots/{snapshotId}" + method = "GET" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_snapshot got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "snapshotId": snapshot_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Snapshot") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="Snapshot") + + def list_export_sets(self, compartment_id, availability_domain, **kwargs): + """ + ListExportSets + Lists the export set resources in the specified compartment. + + + :param str compartment_id: (required) + The OCID of the compartment. + + :param str availability_domain: (required) + The name of the availability domain. + + Example: `Uocm:PHX-AD-1` + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + Example: `500` + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str display_name: (optional) + A user-friendly name. It does not have to be unique, and it is changeable. + + Example: `My resource` + + :param str lifecycle_state: (optional) + Filter results by the specified lifecycle state. Must be a valid + state for the resource type. + + Allowed values are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED" + + :param str id: (optional) + Filter results by OCID. Must be an OCID of the correct type for + the resouce type. + + :param str sort_by: (optional) + The field to sort by. You can provide either value, but not both. + By default, when you sort by time created, results are shown + in descending order. When you sort by display name, results are + shown in ascending order. + + Allowed values are: "TIMECREATED", "DISPLAYNAME" + + :param str sort_order: (optional) + The sort order to use, either 'asc' or 'desc', where 'asc' is + ascending and 'desc' is descending. + + Allowed values are: "ASC", "DESC" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.file_storage.models.ExportSetSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exportSets" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "display_name", + "lifecycle_state", + "id", + "sort_by", + "sort_order" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_export_sets got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["TIMECREATED", "DISPLAYNAME"] + if kwargs['sort_by'] not in sort_by_allowed_values: + raise ValueError( + "Invalid value for `sort_by`, must be one of {0}".format(sort_by_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "compartmentId": compartment_id, + "availabilityDomain": availability_domain, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "displayName": kwargs.get("display_name", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "id": kwargs.get("id", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ExportSetSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ExportSetSummary]") + + def list_exports(self, compartment_id, **kwargs): + """ + ListExports + Lists the export resources in the specified compartment. You must + also specify an export set, a file system, or both. + + + :param str compartment_id: (required) + The OCID of the compartment. + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + Example: `500` + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str export_set_id: (optional) + The OCID of the export set. + + :param str file_system_id: (optional) + The OCID of the file system. + + :param str lifecycle_state: (optional) + Filter results by the specified lifecycle state. Must be a valid + state for the resource type. + + Allowed values are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED" + + :param str id: (optional) + Filter results by OCID. Must be an OCID of the correct type for + the resouce type. + + :param str sort_by: (optional) + The field to sort by. You can provide either value, but not both. + By default, when you sort by time created, results are shown + in descending order. When you sort by path, results are + shown in ascending alphanumeric order. + + Allowed values are: "TIMECREATED", "PATH" + + :param str sort_order: (optional) + The sort order to use, either 'asc' or 'desc', where 'asc' is + ascending and 'desc' is descending. + + Allowed values are: "ASC", "DESC" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.file_storage.models.ExportSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exports" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "export_set_id", + "file_system_id", + "lifecycle_state", + "id", + "sort_by", + "sort_order" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_exports got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["TIMECREATED", "PATH"] + if kwargs['sort_by'] not in sort_by_allowed_values: + raise ValueError( + "Invalid value for `sort_by`, must be one of {0}".format(sort_by_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "compartmentId": compartment_id, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "exportSetId": kwargs.get("export_set_id", missing), + "fileSystemId": kwargs.get("file_system_id", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "id": kwargs.get("id", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ExportSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ExportSummary]") + + def list_file_systems(self, compartment_id, availability_domain, **kwargs): + """ + ListFileSystems + Lists the file system resources in the specified compartment. + + + :param str compartment_id: (required) + The OCID of the compartment. + + :param str availability_domain: (required) + The name of the availability domain. + + Example: `Uocm:PHX-AD-1` + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + Example: `500` + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str display_name: (optional) + A user-friendly name. It does not have to be unique, and it is changeable. + + Example: `My resource` + + :param str lifecycle_state: (optional) + Filter results by the specified lifecycle state. Must be a valid + state for the resource type. + + Allowed values are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED" + + :param str id: (optional) + Filter results by OCID. Must be an OCID of the correct type for + the resouce type. + + :param str sort_by: (optional) + The field to sort by. You can provide either value, but not both. + By default, when you sort by time created, results are shown + in descending order. When you sort by display name, results are + shown in ascending order. + + Allowed values are: "TIMECREATED", "DISPLAYNAME" + + :param str sort_order: (optional) + The sort order to use, either 'asc' or 'desc', where 'asc' is + ascending and 'desc' is descending. + + Allowed values are: "ASC", "DESC" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.file_storage.models.FileSystemSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/fileSystems" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "display_name", + "lifecycle_state", + "id", + "sort_by", + "sort_order" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_file_systems got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["TIMECREATED", "DISPLAYNAME"] + if kwargs['sort_by'] not in sort_by_allowed_values: + raise ValueError( + "Invalid value for `sort_by`, must be one of {0}".format(sort_by_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "compartmentId": compartment_id, + "availabilityDomain": availability_domain, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "displayName": kwargs.get("display_name", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "id": kwargs.get("id", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[FileSystemSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[FileSystemSummary]") + + def list_mount_targets(self, compartment_id, availability_domain, **kwargs): + """ + ListMountTargets + Lists the mount target resources in the specified compartment. + + + :param str compartment_id: (required) + The OCID of the compartment. + + :param str availability_domain: (required) + The name of the availability domain. + + Example: `Uocm:PHX-AD-1` + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + Example: `500` + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str display_name: (optional) + A user-friendly name. It does not have to be unique, and it is changeable. + + Example: `My resource` + + :param str export_set_id: (optional) + The OCID of the export set. + + :param str lifecycle_state: (optional) + Filter results by the specified lifecycle state. Must be a valid + state for the resource type. + + Allowed values are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED" + + :param str id: (optional) + Filter results by OCID. Must be an OCID of the correct type for + the resouce type. + + :param str sort_by: (optional) + The field to sort by. You can choose either value, but not both. + By default, when you sort by time created, results are shown + in descending order. When you sort by display name, results are + shown in ascending order. + + Allowed values are: "TIMECREATED", "DISPLAYNAME" + + :param str sort_order: (optional) + The sort order to use, either 'asc' or 'desc', where 'asc' is + ascending and 'desc' is descending. + + Allowed values are: "ASC", "DESC" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.file_storage.models.MountTargetSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/mountTargets" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "display_name", + "export_set_id", + "lifecycle_state", + "id", + "sort_by", + "sort_order" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_mount_targets got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["TIMECREATED", "DISPLAYNAME"] + if kwargs['sort_by'] not in sort_by_allowed_values: + raise ValueError( + "Invalid value for `sort_by`, must be one of {0}".format(sort_by_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "compartmentId": compartment_id, + "availabilityDomain": availability_domain, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "displayName": kwargs.get("display_name", missing), + "exportSetId": kwargs.get("export_set_id", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "id": kwargs.get("id", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[MountTargetSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[MountTargetSummary]") + + def list_snapshots(self, file_system_id, **kwargs): + """ + ListSnapshots + Lists snapshots of the specified file system. + + + :param str file_system_id: (required) + The OCID of the file system. + + :param int limit: (optional) + The maximum number of items to return in a paginated \"List\" call. + + Example: `500` + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str lifecycle_state: (optional) + Filter results by the specified lifecycle state. Must be a valid + state for the resource type. + + Allowed values are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED" + + :param str id: (optional) + Filter results by OCID. Must be an OCID of the correct type for + the resouce type. + + :param str sort_order: (optional) + The sort order to use, either 'asc' or 'desc', where 'asc' is + ascending and 'desc' is descending. + + Allowed values are: "ASC", "DESC" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.file_storage.models.SnapshotSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/snapshots" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "lifecycle_state", + "id", + "sort_order" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_snapshots got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if kwargs['lifecycle_state'] not in lifecycle_state_allowed_values: + raise ValueError( + "Invalid value for `lifecycle_state`, must be one of {0}".format(lifecycle_state_allowed_values) + ) + + if 'sort_order' in kwargs: + sort_order_allowed_values = ["ASC", "DESC"] + if kwargs['sort_order'] not in sort_order_allowed_values: + raise ValueError( + "Invalid value for `sort_order`, must be one of {0}".format(sort_order_allowed_values) + ) + + query_params = { + "fileSystemId": file_system_id, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "lifecycleState": kwargs.get("lifecycle_state", missing), + "id": kwargs.get("id", missing), + "sortOrder": kwargs.get("sort_order", missing) + } + query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} + + header_params = { + "accept": "application/json", + "content-type": "application/json" + } + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[SnapshotSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[SnapshotSummary]") + + def update_export_set(self, export_set_id, update_export_set_details, **kwargs): + """ + UpdateExportSet + Updates the specified export set's information. + + + :param str export_set_id: (required) + The OCID of the export set. + + :param UpdateExportSetDetails update_export_set_details: (required) + Details object for updating an export set. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.ExportSet` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/exportSets/{exportSetId}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_export_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "exportSetId": export_set_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_export_set_details, + response_type="ExportSet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_export_set_details, + response_type="ExportSet") + + def update_file_system(self, file_system_id, update_file_system_details, **kwargs): + """ + UpdateFileSystem + Updates the specified file system's information. + You can use this operation to rename a file system. + + + :param str file_system_id: (required) + The OCID of the file system. + + :param UpdateFileSystemDetails update_file_system_details: (required) + Details object for updating a file system. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.FileSystem` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/fileSystems/{fileSystemId}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_file_system got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "fileSystemId": file_system_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_file_system_details, + response_type="FileSystem") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_file_system_details, + response_type="FileSystem") + + def update_mount_target(self, mount_target_id, update_mount_target_details, **kwargs): + """ + UpdateMountTarget + Updates the specified mount target's information. + + + :param str mount_target_id: (required) + The OCID of the mount target. + + :param UpdateMountTargetDetails update_mount_target_details: (required) + Details object for updating a mount target. + + :param str if_match: (optional) + For optimistic concurrency control. In the PUT or DELETE call + for a resource, set the `if-match` parameter to the value of the + etag from a previous GET or POST response for that resource. + The resource will be updated or deleted only if the etag you + provide matches the resource's current etag value. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.file_storage.models.MountTarget` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/mountTargets/{mountTargetId}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_mount_target got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "mountTargetId": mount_target_id + } + + path_params = {k: v for (k, v) in six.iteritems(path_params) if v is not missing} + + for (k, v) in six.iteritems(path_params): + if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): + raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + + header_params = { + "accept": "application/json", + "content-type": "application/json", + "if-match": kwargs.get("if_match", missing) + } + header_params = {k: v for (k, v) in six.iteritems(header_params) if v is not missing} + + if 'retry_strategy' in kwargs: + return kwargs['retry_strategy'].make_retrying_call( + self.base_client.call_api, + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_mount_target_details, + response_type="MountTarget") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_mount_target_details, + response_type="MountTarget") diff --git a/src/oci/file_storage/models/__init__.py b/src/oci/file_storage/models/__init__.py new file mode 100644 index 0000000000..f182b56b7a --- /dev/null +++ b/src/oci/file_storage/models/__init__.py @@ -0,0 +1,43 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +from __future__ import absolute_import + +from .create_export_details import CreateExportDetails +from .create_file_system_details import CreateFileSystemDetails +from .create_mount_target_details import CreateMountTargetDetails +from .create_snapshot_details import CreateSnapshotDetails +from .export import Export +from .export_set import ExportSet +from .export_set_summary import ExportSetSummary +from .export_summary import ExportSummary +from .file_system import FileSystem +from .file_system_summary import FileSystemSummary +from .mount_target import MountTarget +from .mount_target_summary import MountTargetSummary +from .snapshot import Snapshot +from .snapshot_summary import SnapshotSummary +from .update_export_set_details import UpdateExportSetDetails +from .update_file_system_details import UpdateFileSystemDetails +from .update_mount_target_details import UpdateMountTargetDetails + +# Maps type names to classes for file_storage services. +file_storage_type_mapping = { + "CreateExportDetails": CreateExportDetails, + "CreateFileSystemDetails": CreateFileSystemDetails, + "CreateMountTargetDetails": CreateMountTargetDetails, + "CreateSnapshotDetails": CreateSnapshotDetails, + "Export": Export, + "ExportSet": ExportSet, + "ExportSetSummary": ExportSetSummary, + "ExportSummary": ExportSummary, + "FileSystem": FileSystem, + "FileSystemSummary": FileSystemSummary, + "MountTarget": MountTarget, + "MountTargetSummary": MountTargetSummary, + "Snapshot": Snapshot, + "SnapshotSummary": SnapshotSummary, + "UpdateExportSetDetails": UpdateExportSetDetails, + "UpdateFileSystemDetails": UpdateFileSystemDetails, + "UpdateMountTargetDetails": UpdateMountTargetDetails +} diff --git a/src/oci/file_storage/models/create_export_details.py b/src/oci/file_storage/models/create_export_details.py new file mode 100644 index 0000000000..06910a6e88 --- /dev/null +++ b/src/oci/file_storage/models/create_export_details.py @@ -0,0 +1,136 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateExportDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateExportDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param export_set_id: + The value to assign to the export_set_id property of this CreateExportDetails. + :type export_set_id: str + + :param file_system_id: + The value to assign to the file_system_id property of this CreateExportDetails. + :type file_system_id: str + + :param path: + The value to assign to the path property of this CreateExportDetails. + :type path: str + + """ + self.swagger_types = { + 'export_set_id': 'str', + 'file_system_id': 'str', + 'path': 'str' + } + + self.attribute_map = { + 'export_set_id': 'exportSetId', + 'file_system_id': 'fileSystemId', + 'path': 'path' + } + + self._export_set_id = None + self._file_system_id = None + self._path = None + + @property + def export_set_id(self): + """ + **[Required]** Gets the export_set_id of this CreateExportDetails. + The OCID of this export's export set. + + + :return: The export_set_id of this CreateExportDetails. + :rtype: str + """ + return self._export_set_id + + @export_set_id.setter + def export_set_id(self, export_set_id): + """ + Sets the export_set_id of this CreateExportDetails. + The OCID of this export's export set. + + + :param export_set_id: The export_set_id of this CreateExportDetails. + :type: str + """ + self._export_set_id = export_set_id + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this CreateExportDetails. + The OCID of this export's file system. + + + :return: The file_system_id of this CreateExportDetails. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this CreateExportDetails. + The OCID of this export's file system. + + + :param file_system_id: The file_system_id of this CreateExportDetails. + :type: str + """ + self._file_system_id = file_system_id + + @property + def path(self): + """ + **[Required]** Gets the path of this CreateExportDetails. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/mediafiles` + + + :return: The path of this CreateExportDetails. + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """ + Sets the path of this CreateExportDetails. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/mediafiles` + + + :param path: The path of this CreateExportDetails. + :type: str + """ + self._path = path + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/create_file_system_details.py b/src/oci/file_storage/models/create_file_system_details.py new file mode 100644 index 0000000000..2b5fc035d8 --- /dev/null +++ b/src/oci/file_storage/models/create_file_system_details.py @@ -0,0 +1,138 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateFileSystemDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateFileSystemDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this CreateFileSystemDetails. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this CreateFileSystemDetails. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this CreateFileSystemDetails. + :type display_name: str + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + + @property + def availability_domain(self): + """ + **[Required]** Gets the availability_domain of this CreateFileSystemDetails. + The availability domain to create the file system in. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this CreateFileSystemDetails. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this CreateFileSystemDetails. + The availability domain to create the file system in. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this CreateFileSystemDetails. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this CreateFileSystemDetails. + The OCID of the compartment to create the file system in. + + + :return: The compartment_id of this CreateFileSystemDetails. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this CreateFileSystemDetails. + The OCID of the compartment to create the file system in. + + + :param compartment_id: The compartment_id of this CreateFileSystemDetails. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + Gets the display_name of this CreateFileSystemDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :return: The display_name of this CreateFileSystemDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this CreateFileSystemDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :param display_name: The display_name of this CreateFileSystemDetails. + :type: str + """ + self._display_name = display_name + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/create_mount_target_details.py b/src/oci/file_storage/models/create_mount_target_details.py new file mode 100644 index 0000000000..7aed1e17f5 --- /dev/null +++ b/src/oci/file_storage/models/create_mount_target_details.py @@ -0,0 +1,269 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateMountTargetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateMountTargetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this CreateMountTargetDetails. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this CreateMountTargetDetails. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this CreateMountTargetDetails. + :type display_name: str + + :param hostname_label: + The value to assign to the hostname_label property of this CreateMountTargetDetails. + :type hostname_label: str + + :param ip_address: + The value to assign to the ip_address property of this CreateMountTargetDetails. + :type ip_address: str + + :param subnet_id: + The value to assign to the subnet_id property of this CreateMountTargetDetails. + :type subnet_id: str + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'hostname_label': 'str', + 'ip_address': 'str', + 'subnet_id': 'str' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'hostname_label': 'hostnameLabel', + 'ip_address': 'ipAddress', + 'subnet_id': 'subnetId' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._hostname_label = None + self._ip_address = None + self._subnet_id = None + + @property + def availability_domain(self): + """ + **[Required]** Gets the availability_domain of this CreateMountTargetDetails. + The availability domain in which to create the mount target. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this CreateMountTargetDetails. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this CreateMountTargetDetails. + The availability domain in which to create the mount target. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this CreateMountTargetDetails. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this CreateMountTargetDetails. + The OCID of the compartment in which to create the mount target. + + + :return: The compartment_id of this CreateMountTargetDetails. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this CreateMountTargetDetails. + The OCID of the compartment in which to create the mount target. + + + :param compartment_id: The compartment_id of this CreateMountTargetDetails. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + Gets the display_name of this CreateMountTargetDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :return: The display_name of this CreateMountTargetDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this CreateMountTargetDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :param display_name: The display_name of this CreateMountTargetDetails. + :type: str + """ + self._display_name = display_name + + @property + def hostname_label(self): + """ + Gets the hostname_label of this CreateMountTargetDetails. + The hostname for the mount target's IP address, used for + DNS resolution. The value is the hostname portion of the private IP + address's fully qualified domain name (FQDN). For example, + `files-1` in the FQDN `files-1.subnet123.vcn1.oraclevcn.com`. + Must be unique across all VNICs in the subnet and comply + with `RFC 952`__ + and `RFC 1123`__. + + For more information, see + `DNS in Your Virtual Cloud Network`__. + + Example: `files-1` + + __ https://tools.ietf.org/html/rfc952 + __ https://tools.ietf.org/html/rfc1123 + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm + + + :return: The hostname_label of this CreateMountTargetDetails. + :rtype: str + """ + return self._hostname_label + + @hostname_label.setter + def hostname_label(self, hostname_label): + """ + Sets the hostname_label of this CreateMountTargetDetails. + The hostname for the mount target's IP address, used for + DNS resolution. The value is the hostname portion of the private IP + address's fully qualified domain name (FQDN). For example, + `files-1` in the FQDN `files-1.subnet123.vcn1.oraclevcn.com`. + Must be unique across all VNICs in the subnet and comply + with `RFC 952`__ + and `RFC 1123`__. + + For more information, see + `DNS in Your Virtual Cloud Network`__. + + Example: `files-1` + + __ https://tools.ietf.org/html/rfc952 + __ https://tools.ietf.org/html/rfc1123 + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm + + + :param hostname_label: The hostname_label of this CreateMountTargetDetails. + :type: str + """ + self._hostname_label = hostname_label + + @property + def ip_address(self): + """ + Gets the ip_address of this CreateMountTargetDetails. + A private IP address of your choice. Must be an available IP address within + the subnet's CIDR. If you don't specify a value, Oracle automatically + assigns a private IP address from the subnet. + + Example: `10.0.3.3` + + + :return: The ip_address of this CreateMountTargetDetails. + :rtype: str + """ + return self._ip_address + + @ip_address.setter + def ip_address(self, ip_address): + """ + Sets the ip_address of this CreateMountTargetDetails. + A private IP address of your choice. Must be an available IP address within + the subnet's CIDR. If you don't specify a value, Oracle automatically + assigns a private IP address from the subnet. + + Example: `10.0.3.3` + + + :param ip_address: The ip_address of this CreateMountTargetDetails. + :type: str + """ + self._ip_address = ip_address + + @property + def subnet_id(self): + """ + **[Required]** Gets the subnet_id of this CreateMountTargetDetails. + The OCID of the subnet in which to create the mount target. + + + :return: The subnet_id of this CreateMountTargetDetails. + :rtype: str + """ + return self._subnet_id + + @subnet_id.setter + def subnet_id(self, subnet_id): + """ + Sets the subnet_id of this CreateMountTargetDetails. + The OCID of the subnet in which to create the mount target. + + + :param subnet_id: The subnet_id of this CreateMountTargetDetails. + :type: str + """ + self._subnet_id = subnet_id + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/create_snapshot_details.py b/src/oci/file_storage/models/create_snapshot_details.py new file mode 100644 index 0000000000..4a4a29c1f0 --- /dev/null +++ b/src/oci/file_storage/models/create_snapshot_details.py @@ -0,0 +1,109 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class CreateSnapshotDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateSnapshotDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param file_system_id: + The value to assign to the file_system_id property of this CreateSnapshotDetails. + :type file_system_id: str + + :param name: + The value to assign to the name property of this CreateSnapshotDetails. + :type name: str + + """ + self.swagger_types = { + 'file_system_id': 'str', + 'name': 'str' + } + + self.attribute_map = { + 'file_system_id': 'fileSystemId', + 'name': 'name' + } + + self._file_system_id = None + self._name = None + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this CreateSnapshotDetails. + The OCID of this export's file system. + + + :return: The file_system_id of this CreateSnapshotDetails. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this CreateSnapshotDetails. + The OCID of this export's file system. + + + :param file_system_id: The file_system_id of this CreateSnapshotDetails. + :type: str + """ + self._file_system_id = file_system_id + + @property + def name(self): + """ + **[Required]** Gets the name of this CreateSnapshotDetails. + Name of the snapshot. This value is immutable. It must also be unique with respect + to all other non-DELETED snapshots on the associated file + system. + + Avoid entering confidential information. + + Example: `Sunday` + + + :return: The name of this CreateSnapshotDetails. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this CreateSnapshotDetails. + Name of the snapshot. This value is immutable. It must also be unique with respect + to all other non-DELETED snapshots on the associated file + system. + + Avoid entering confidential information. + + Example: `Sunday` + + + :param name: The name of this CreateSnapshotDetails. + :type: str + """ + self._name = name + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/export.py b/src/oci/file_storage/models/export.py new file mode 100644 index 0000000000..03e964f9fd --- /dev/null +++ b/src/oci/file_storage/models/export.py @@ -0,0 +1,247 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class Export(object): + + def __init__(self, **kwargs): + """ + Initializes a new Export object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param export_set_id: + The value to assign to the export_set_id property of this Export. + :type export_set_id: str + + :param file_system_id: + The value to assign to the file_system_id property of this Export. + :type file_system_id: str + + :param id: + The value to assign to the id property of this Export. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this Export. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param path: + The value to assign to the path property of this Export. + :type path: str + + :param time_created: + The value to assign to the time_created property of this Export. + :type time_created: datetime + + """ + self.swagger_types = { + 'export_set_id': 'str', + 'file_system_id': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'path': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'export_set_id': 'exportSetId', + 'file_system_id': 'fileSystemId', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'path': 'path', + 'time_created': 'timeCreated' + } + + self._export_set_id = None + self._file_system_id = None + self._id = None + self._lifecycle_state = None + self._path = None + self._time_created = None + + @property + def export_set_id(self): + """ + **[Required]** Gets the export_set_id of this Export. + The OCID of this export's export set. + + + :return: The export_set_id of this Export. + :rtype: str + """ + return self._export_set_id + + @export_set_id.setter + def export_set_id(self, export_set_id): + """ + Sets the export_set_id of this Export. + The OCID of this export's export set. + + + :param export_set_id: The export_set_id of this Export. + :type: str + """ + self._export_set_id = export_set_id + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this Export. + The OCID of this export's file system. + + + :return: The file_system_id of this Export. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this Export. + The OCID of this export's file system. + + + :param file_system_id: The file_system_id of this Export. + :type: str + """ + self._file_system_id = file_system_id + + @property + def id(self): + """ + **[Required]** Gets the id of this Export. + The OCID of this export. + + + :return: The id of this Export. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Export. + The OCID of this export. + + + :param id: The id of this Export. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this Export. + The current state of this export. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this Export. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this Export. + The current state of this export. + + + :param lifecycle_state: The lifecycle_state of this Export. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def path(self): + """ + **[Required]** Gets the path of this Export. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/accounting` + + + :return: The path of this Export. + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """ + Sets the path of this Export. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/accounting` + + + :param path: The path of this Export. + :type: str + """ + self._path = path + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this Export. + The date and time the export was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this Export. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this Export. + The date and time the export was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this Export. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/export_set.py b/src/oci/file_storage/models/export_set.py new file mode 100644 index 0000000000..753413288d --- /dev/null +++ b/src/oci/file_storage/models/export_set.py @@ -0,0 +1,376 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class ExportSet(object): + + def __init__(self, **kwargs): + """ + Initializes a new ExportSet object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this ExportSet. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this ExportSet. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this ExportSet. + :type display_name: str + + :param id: + The value to assign to the id property of this ExportSet. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this ExportSet. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param max_fs_stat_bytes: + The value to assign to the max_fs_stat_bytes property of this ExportSet. + :type max_fs_stat_bytes: int + + :param max_fs_stat_files: + The value to assign to the max_fs_stat_files property of this ExportSet. + :type max_fs_stat_files: int + + :param time_created: + The value to assign to the time_created property of this ExportSet. + :type time_created: datetime + + :param vcn_id: + The value to assign to the vcn_id property of this ExportSet. + :type vcn_id: str + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'max_fs_stat_bytes': 'int', + 'max_fs_stat_files': 'int', + 'time_created': 'datetime', + 'vcn_id': 'str' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'max_fs_stat_bytes': 'maxFsStatBytes', + 'max_fs_stat_files': 'maxFsStatFiles', + 'time_created': 'timeCreated', + 'vcn_id': 'vcnId' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._id = None + self._lifecycle_state = None + self._max_fs_stat_bytes = None + self._max_fs_stat_files = None + self._time_created = None + self._vcn_id = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this ExportSet. + The availability domain the export set is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this ExportSet. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this ExportSet. + The availability domain the export set is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this ExportSet. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this ExportSet. + The OCID of the compartment that contains the export set. + + + :return: The compartment_id of this ExportSet. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this ExportSet. + The OCID of the compartment that contains the export set. + + + :param compartment_id: The compartment_id of this ExportSet. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this ExportSet. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :return: The display_name of this ExportSet. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this ExportSet. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :param display_name: The display_name of this ExportSet. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + **[Required]** Gets the id of this ExportSet. + The OCID of the export set. + + + :return: The id of this ExportSet. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this ExportSet. + The OCID of the export set. + + + :param id: The id of this ExportSet. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this ExportSet. + The current state of the export set. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this ExportSet. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this ExportSet. + The current state of the export set. + + + :param lifecycle_state: The lifecycle_state of this ExportSet. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def max_fs_stat_bytes(self): + """ + Gets the max_fs_stat_bytes of this ExportSet. + Controls the maximum `tbytes`, `fbytes`, and `abytes`, + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tbytes` value reported by `FSSTAT` will be + `maxFsStatBytes`. The value of `fbytes` and `abytes` will be + `maxFsStatBytes` minus the metered size of the file + system. If the metered size is larger than `maxFsStatBytes`, + then `fbytes` and `abytes` will both be '0'. + + + :return: The max_fs_stat_bytes of this ExportSet. + :rtype: int + """ + return self._max_fs_stat_bytes + + @max_fs_stat_bytes.setter + def max_fs_stat_bytes(self, max_fs_stat_bytes): + """ + Sets the max_fs_stat_bytes of this ExportSet. + Controls the maximum `tbytes`, `fbytes`, and `abytes`, + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tbytes` value reported by `FSSTAT` will be + `maxFsStatBytes`. The value of `fbytes` and `abytes` will be + `maxFsStatBytes` minus the metered size of the file + system. If the metered size is larger than `maxFsStatBytes`, + then `fbytes` and `abytes` will both be '0'. + + + :param max_fs_stat_bytes: The max_fs_stat_bytes of this ExportSet. + :type: int + """ + self._max_fs_stat_bytes = max_fs_stat_bytes + + @property + def max_fs_stat_files(self): + """ + Gets the max_fs_stat_files of this ExportSet. + Controls the maximum `ffiles`, `ffiles`, and `afiles` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tfiles` value reported by `FSSTAT` will be + `maxFsStatFiles`. The value of `ffiles` and `afiles` will be + `maxFsStatFiles` minus the metered size of the file + system. If the metered size is larger than `maxFsStatFiles`, + then `ffiles` and `afiles` will both be '0'. + + + :return: The max_fs_stat_files of this ExportSet. + :rtype: int + """ + return self._max_fs_stat_files + + @max_fs_stat_files.setter + def max_fs_stat_files(self, max_fs_stat_files): + """ + Sets the max_fs_stat_files of this ExportSet. + Controls the maximum `ffiles`, `ffiles`, and `afiles` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tfiles` value reported by `FSSTAT` will be + `maxFsStatFiles`. The value of `ffiles` and `afiles` will be + `maxFsStatFiles` minus the metered size of the file + system. If the metered size is larger than `maxFsStatFiles`, + then `ffiles` and `afiles` will both be '0'. + + + :param max_fs_stat_files: The max_fs_stat_files of this ExportSet. + :type: int + """ + self._max_fs_stat_files = max_fs_stat_files + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this ExportSet. + The date and time the export set was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this ExportSet. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this ExportSet. + The date and time the export set was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this ExportSet. + :type: datetime + """ + self._time_created = time_created + + @property + def vcn_id(self): + """ + **[Required]** Gets the vcn_id of this ExportSet. + The OCID of the virtual cloud network (VCN) the export set is in. + + + :return: The vcn_id of this ExportSet. + :rtype: str + """ + return self._vcn_id + + @vcn_id.setter + def vcn_id(self, vcn_id): + """ + Sets the vcn_id of this ExportSet. + The OCID of the virtual cloud network (VCN) the export set is in. + + + :param vcn_id: The vcn_id of this ExportSet. + :type: str + """ + self._vcn_id = vcn_id + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/export_set_summary.py b/src/oci/file_storage/models/export_set_summary.py new file mode 100644 index 0000000000..cd337098bb --- /dev/null +++ b/src/oci/file_storage/models/export_set_summary.py @@ -0,0 +1,282 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class ExportSetSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new ExportSetSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this ExportSetSummary. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this ExportSetSummary. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this ExportSetSummary. + :type display_name: str + + :param id: + The value to assign to the id property of this ExportSetSummary. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this ExportSetSummary. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param time_created: + The value to assign to the time_created property of this ExportSetSummary. + :type time_created: datetime + + :param vcn_id: + The value to assign to the vcn_id property of this ExportSetSummary. + :type vcn_id: str + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'time_created': 'datetime', + 'vcn_id': 'str' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'time_created': 'timeCreated', + 'vcn_id': 'vcnId' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._id = None + self._lifecycle_state = None + self._time_created = None + self._vcn_id = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this ExportSetSummary. + The availability domain the export set is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this ExportSetSummary. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this ExportSetSummary. + The availability domain the export set is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this ExportSetSummary. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this ExportSetSummary. + The OCID of the compartment that contains the export set. + + + :return: The compartment_id of this ExportSetSummary. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this ExportSetSummary. + The OCID of the compartment that contains the export set. + + + :param compartment_id: The compartment_id of this ExportSetSummary. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this ExportSetSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :return: The display_name of this ExportSetSummary. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this ExportSetSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :param display_name: The display_name of this ExportSetSummary. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + **[Required]** Gets the id of this ExportSetSummary. + The OCID of the export set. + + + :return: The id of this ExportSetSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this ExportSetSummary. + The OCID of the export set. + + + :param id: The id of this ExportSetSummary. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this ExportSetSummary. + The current state of the export set. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this ExportSetSummary. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this ExportSetSummary. + The current state of the export set. + + + :param lifecycle_state: The lifecycle_state of this ExportSetSummary. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this ExportSetSummary. + The date and time the export set was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this ExportSetSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this ExportSetSummary. + The date and time the export set was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this ExportSetSummary. + :type: datetime + """ + self._time_created = time_created + + @property + def vcn_id(self): + """ + **[Required]** Gets the vcn_id of this ExportSetSummary. + The OCID of the virtual cloud network (VCN) the export set is in. + + + :return: The vcn_id of this ExportSetSummary. + :rtype: str + """ + return self._vcn_id + + @vcn_id.setter + def vcn_id(self, vcn_id): + """ + Sets the vcn_id of this ExportSetSummary. + The OCID of the virtual cloud network (VCN) the export set is in. + + + :param vcn_id: The vcn_id of this ExportSetSummary. + :type: str + """ + self._vcn_id = vcn_id + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/export_summary.py b/src/oci/file_storage/models/export_summary.py new file mode 100644 index 0000000000..97b4d06fb9 --- /dev/null +++ b/src/oci/file_storage/models/export_summary.py @@ -0,0 +1,247 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class ExportSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new ExportSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param export_set_id: + The value to assign to the export_set_id property of this ExportSummary. + :type export_set_id: str + + :param file_system_id: + The value to assign to the file_system_id property of this ExportSummary. + :type file_system_id: str + + :param id: + The value to assign to the id property of this ExportSummary. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this ExportSummary. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param path: + The value to assign to the path property of this ExportSummary. + :type path: str + + :param time_created: + The value to assign to the time_created property of this ExportSummary. + :type time_created: datetime + + """ + self.swagger_types = { + 'export_set_id': 'str', + 'file_system_id': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'path': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'export_set_id': 'exportSetId', + 'file_system_id': 'fileSystemId', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'path': 'path', + 'time_created': 'timeCreated' + } + + self._export_set_id = None + self._file_system_id = None + self._id = None + self._lifecycle_state = None + self._path = None + self._time_created = None + + @property + def export_set_id(self): + """ + **[Required]** Gets the export_set_id of this ExportSummary. + The OCID of this export's export set. + + + :return: The export_set_id of this ExportSummary. + :rtype: str + """ + return self._export_set_id + + @export_set_id.setter + def export_set_id(self, export_set_id): + """ + Sets the export_set_id of this ExportSummary. + The OCID of this export's export set. + + + :param export_set_id: The export_set_id of this ExportSummary. + :type: str + """ + self._export_set_id = export_set_id + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this ExportSummary. + The OCID of this export's file system. + + + :return: The file_system_id of this ExportSummary. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this ExportSummary. + The OCID of this export's file system. + + + :param file_system_id: The file_system_id of this ExportSummary. + :type: str + """ + self._file_system_id = file_system_id + + @property + def id(self): + """ + **[Required]** Gets the id of this ExportSummary. + The OCID of this export. + + + :return: The id of this ExportSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this ExportSummary. + The OCID of this export. + + + :param id: The id of this ExportSummary. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this ExportSummary. + The current state of this export. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this ExportSummary. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this ExportSummary. + The current state of this export. + + + :param lifecycle_state: The lifecycle_state of this ExportSummary. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def path(self): + """ + **[Required]** Gets the path of this ExportSummary. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/mediafiles` + + + :return: The path of this ExportSummary. + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """ + Sets the path of this ExportSummary. + Path used to access the associated file system. + + Avoid entering confidential information. + + Example: `/mediafiles` + + + :param path: The path of this ExportSummary. + :type: str + """ + self._path = path + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this ExportSummary. + The date and time the export was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this ExportSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this ExportSummary. + The date and time the export was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this ExportSummary. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/file_system.py b/src/oci/file_storage/models/file_system.py new file mode 100644 index 0000000000..2af42ddc4d --- /dev/null +++ b/src/oci/file_storage/models/file_system.py @@ -0,0 +1,288 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class FileSystem(object): + + def __init__(self, **kwargs): + """ + Initializes a new FileSystem object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this FileSystem. + :type availability_domain: str + + :param metered_bytes: + The value to assign to the metered_bytes property of this FileSystem. + :type metered_bytes: int + + :param compartment_id: + The value to assign to the compartment_id property of this FileSystem. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this FileSystem. + :type display_name: str + + :param id: + The value to assign to the id property of this FileSystem. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this FileSystem. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param time_created: + The value to assign to the time_created property of this FileSystem. + :type time_created: datetime + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'metered_bytes': 'int', + 'compartment_id': 'str', + 'display_name': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'metered_bytes': 'meteredBytes', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'time_created': 'timeCreated' + } + + self._availability_domain = None + self._metered_bytes = None + self._compartment_id = None + self._display_name = None + self._id = None + self._lifecycle_state = None + self._time_created = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this FileSystem. + The availability domain the file system is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this FileSystem. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this FileSystem. + The availability domain the file system is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this FileSystem. + :type: str + """ + self._availability_domain = availability_domain + + @property + def metered_bytes(self): + """ + **[Required]** Gets the metered_bytes of this FileSystem. + The number of bytes consumed by the file system, including + any snapshots. This number reflects the metered size of the file + system and is updated asynchronously with respect to + updates to the file system. + + + :return: The metered_bytes of this FileSystem. + :rtype: int + """ + return self._metered_bytes + + @metered_bytes.setter + def metered_bytes(self, metered_bytes): + """ + Sets the metered_bytes of this FileSystem. + The number of bytes consumed by the file system, including + any snapshots. This number reflects the metered size of the file + system and is updated asynchronously with respect to + updates to the file system. + + + :param metered_bytes: The metered_bytes of this FileSystem. + :type: int + """ + self._metered_bytes = metered_bytes + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this FileSystem. + The OCID of the compartment that contains the file system. + + + :return: The compartment_id of this FileSystem. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this FileSystem. + The OCID of the compartment that contains the file system. + + + :param compartment_id: The compartment_id of this FileSystem. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this FileSystem. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :return: The display_name of this FileSystem. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this FileSystem. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :param display_name: The display_name of this FileSystem. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + **[Required]** Gets the id of this FileSystem. + The OCID of the file system. + + + :return: The id of this FileSystem. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this FileSystem. + The OCID of the file system. + + + :param id: The id of this FileSystem. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this FileSystem. + The current state of the file system. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this FileSystem. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this FileSystem. + The current state of the file system. + + + :param lifecycle_state: The lifecycle_state of this FileSystem. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this FileSystem. + The date and time the file system was created, expressed in + `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this FileSystem. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this FileSystem. + The date and time the file system was created, expressed in + `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this FileSystem. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/file_system_summary.py b/src/oci/file_storage/models/file_system_summary.py new file mode 100644 index 0000000000..954514d020 --- /dev/null +++ b/src/oci/file_storage/models/file_system_summary.py @@ -0,0 +1,294 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class FileSystemSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new FileSystemSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this FileSystemSummary. + :type availability_domain: str + + :param metered_bytes: + The value to assign to the metered_bytes property of this FileSystemSummary. + :type metered_bytes: int + + :param compartment_id: + The value to assign to the compartment_id property of this FileSystemSummary. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this FileSystemSummary. + :type display_name: str + + :param id: + The value to assign to the id property of this FileSystemSummary. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this FileSystemSummary. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param time_created: + The value to assign to the time_created property of this FileSystemSummary. + :type time_created: datetime + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'metered_bytes': 'int', + 'compartment_id': 'str', + 'display_name': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'metered_bytes': 'meteredBytes', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'time_created': 'timeCreated' + } + + self._availability_domain = None + self._metered_bytes = None + self._compartment_id = None + self._display_name = None + self._id = None + self._lifecycle_state = None + self._time_created = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this FileSystemSummary. + The availability domain the file system is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this FileSystemSummary. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this FileSystemSummary. + The availability domain the file system is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this FileSystemSummary. + :type: str + """ + self._availability_domain = availability_domain + + @property + def metered_bytes(self): + """ + **[Required]** Gets the metered_bytes of this FileSystemSummary. + The number of bytes consumed by the file system, including + any snapshots. This number reflects the metered size of the file + system and is updated asynchronously with respect to + updates to the file system. For details on file system + metering see `File System Metering`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/File/Concepts/metering.htm + + + :return: The metered_bytes of this FileSystemSummary. + :rtype: int + """ + return self._metered_bytes + + @metered_bytes.setter + def metered_bytes(self, metered_bytes): + """ + Sets the metered_bytes of this FileSystemSummary. + The number of bytes consumed by the file system, including + any snapshots. This number reflects the metered size of the file + system and is updated asynchronously with respect to + updates to the file system. For details on file system + metering see `File System Metering`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/File/Concepts/metering.htm + + + :param metered_bytes: The metered_bytes of this FileSystemSummary. + :type: int + """ + self._metered_bytes = metered_bytes + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this FileSystemSummary. + The OCID of the compartment that contains the file system. + + + :return: The compartment_id of this FileSystemSummary. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this FileSystemSummary. + The OCID of the compartment that contains the file system. + + + :param compartment_id: The compartment_id of this FileSystemSummary. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this FileSystemSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :return: The display_name of this FileSystemSummary. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this FileSystemSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :param display_name: The display_name of this FileSystemSummary. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + **[Required]** Gets the id of this FileSystemSummary. + The OCID of the file system. + + + :return: The id of this FileSystemSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this FileSystemSummary. + The OCID of the file system. + + + :param id: The id of this FileSystemSummary. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this FileSystemSummary. + The current state of the file system. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this FileSystemSummary. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this FileSystemSummary. + The current state of the file system. + + + :param lifecycle_state: The lifecycle_state of this FileSystemSummary. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this FileSystemSummary. + The date and time the file system was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this FileSystemSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this FileSystemSummary. + The date and time the file system was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this FileSystemSummary. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/mount_target.py b/src/oci/file_storage/models/mount_target.py new file mode 100644 index 0000000000..dbfd5f6fa0 --- /dev/null +++ b/src/oci/file_storage/models/mount_target.py @@ -0,0 +1,379 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class MountTarget(object): + + def __init__(self, **kwargs): + """ + Initializes a new MountTarget object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this MountTarget. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this MountTarget. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this MountTarget. + :type display_name: str + + :param export_set_id: + The value to assign to the export_set_id property of this MountTarget. + :type export_set_id: str + + :param id: + The value to assign to the id property of this MountTarget. + :type id: str + + :param lifecycle_details: + The value to assign to the lifecycle_details property of this MountTarget. + :type lifecycle_details: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this MountTarget. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param private_ip_ids: + The value to assign to the private_ip_ids property of this MountTarget. + :type private_ip_ids: list[str] + + :param subnet_id: + The value to assign to the subnet_id property of this MountTarget. + :type subnet_id: str + + :param time_created: + The value to assign to the time_created property of this MountTarget. + :type time_created: datetime + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'export_set_id': 'str', + 'id': 'str', + 'lifecycle_details': 'str', + 'lifecycle_state': 'str', + 'private_ip_ids': 'list[str]', + 'subnet_id': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'export_set_id': 'exportSetId', + 'id': 'id', + 'lifecycle_details': 'lifecycleDetails', + 'lifecycle_state': 'lifecycleState', + 'private_ip_ids': 'privateIpIds', + 'subnet_id': 'subnetId', + 'time_created': 'timeCreated' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._export_set_id = None + self._id = None + self._lifecycle_details = None + self._lifecycle_state = None + self._private_ip_ids = None + self._subnet_id = None + self._time_created = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this MountTarget. + The availability domain the mount target is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this MountTarget. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this MountTarget. + The availability domain the mount target is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this MountTarget. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this MountTarget. + The OCID of the compartment that contains the mount target. + + + :return: The compartment_id of this MountTarget. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this MountTarget. + The OCID of the compartment that contains the mount target. + + + :param compartment_id: The compartment_id of this MountTarget. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this MountTarget. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :return: The display_name of this MountTarget. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this MountTarget. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :param display_name: The display_name of this MountTarget. + :type: str + """ + self._display_name = display_name + + @property + def export_set_id(self): + """ + Gets the export_set_id of this MountTarget. + The OCID of the associated export set. Controls what file + systems will be exported through Network File System (NFS) protocol on this + mount target. + + + :return: The export_set_id of this MountTarget. + :rtype: str + """ + return self._export_set_id + + @export_set_id.setter + def export_set_id(self, export_set_id): + """ + Sets the export_set_id of this MountTarget. + The OCID of the associated export set. Controls what file + systems will be exported through Network File System (NFS) protocol on this + mount target. + + + :param export_set_id: The export_set_id of this MountTarget. + :type: str + """ + self._export_set_id = export_set_id + + @property + def id(self): + """ + **[Required]** Gets the id of this MountTarget. + The OCID of the mount target. + + + :return: The id of this MountTarget. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this MountTarget. + The OCID of the mount target. + + + :param id: The id of this MountTarget. + :type: str + """ + self._id = id + + @property + def lifecycle_details(self): + """ + **[Required]** Gets the lifecycle_details of this MountTarget. + Additional information about the current 'lifecycleState'. + + + :return: The lifecycle_details of this MountTarget. + :rtype: str + """ + return self._lifecycle_details + + @lifecycle_details.setter + def lifecycle_details(self, lifecycle_details): + """ + Sets the lifecycle_details of this MountTarget. + Additional information about the current 'lifecycleState'. + + + :param lifecycle_details: The lifecycle_details of this MountTarget. + :type: str + """ + self._lifecycle_details = lifecycle_details + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this MountTarget. + The current state of the mount target. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this MountTarget. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this MountTarget. + The current state of the mount target. + + + :param lifecycle_state: The lifecycle_state of this MountTarget. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def private_ip_ids(self): + """ + **[Required]** Gets the private_ip_ids of this MountTarget. + The OCIDs of the private IP addresses associated with this mount target. + + + :return: The private_ip_ids of this MountTarget. + :rtype: list[str] + """ + return self._private_ip_ids + + @private_ip_ids.setter + def private_ip_ids(self, private_ip_ids): + """ + Sets the private_ip_ids of this MountTarget. + The OCIDs of the private IP addresses associated with this mount target. + + + :param private_ip_ids: The private_ip_ids of this MountTarget. + :type: list[str] + """ + self._private_ip_ids = private_ip_ids + + @property + def subnet_id(self): + """ + **[Required]** Gets the subnet_id of this MountTarget. + The OCID of the subnet the mount target is in. + + + :return: The subnet_id of this MountTarget. + :rtype: str + """ + return self._subnet_id + + @subnet_id.setter + def subnet_id(self, subnet_id): + """ + Sets the subnet_id of this MountTarget. + The OCID of the subnet the mount target is in. + + + :param subnet_id: The subnet_id of this MountTarget. + :type: str + """ + self._subnet_id = subnet_id + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this MountTarget. + The date and time the mount target was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this MountTarget. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this MountTarget. + The date and time the mount target was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this MountTarget. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/mount_target_summary.py b/src/oci/file_storage/models/mount_target_summary.py new file mode 100644 index 0000000000..a47128d427 --- /dev/null +++ b/src/oci/file_storage/models/mount_target_summary.py @@ -0,0 +1,348 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class MountTargetSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new MountTargetSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param availability_domain: + The value to assign to the availability_domain property of this MountTargetSummary. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this MountTargetSummary. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this MountTargetSummary. + :type display_name: str + + :param export_set_id: + The value to assign to the export_set_id property of this MountTargetSummary. + :type export_set_id: str + + :param id: + The value to assign to the id property of this MountTargetSummary. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this MountTargetSummary. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param private_ip_ids: + The value to assign to the private_ip_ids property of this MountTargetSummary. + :type private_ip_ids: list[str] + + :param subnet_id: + The value to assign to the subnet_id property of this MountTargetSummary. + :type subnet_id: str + + :param time_created: + The value to assign to the time_created property of this MountTargetSummary. + :type time_created: datetime + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'export_set_id': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'private_ip_ids': 'list[str]', + 'subnet_id': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'export_set_id': 'exportSetId', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'private_ip_ids': 'privateIpIds', + 'subnet_id': 'subnetId', + 'time_created': 'timeCreated' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._export_set_id = None + self._id = None + self._lifecycle_state = None + self._private_ip_ids = None + self._subnet_id = None + self._time_created = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this MountTargetSummary. + The availability domain the mount target is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this MountTargetSummary. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this MountTargetSummary. + The availability domain the mount target is in. May be unset + as a blank or NULL value. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this MountTargetSummary. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this MountTargetSummary. + The OCID of the compartment that contains the mount target. + + + :return: The compartment_id of this MountTargetSummary. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this MountTargetSummary. + The OCID of the compartment that contains the mount target. + + + :param compartment_id: The compartment_id of this MountTargetSummary. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this MountTargetSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :return: The display_name of this MountTargetSummary. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this MountTargetSummary. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :param display_name: The display_name of this MountTargetSummary. + :type: str + """ + self._display_name = display_name + + @property + def export_set_id(self): + """ + Gets the export_set_id of this MountTargetSummary. + The OCID of the associated export set. Controls what file + systems will be exported using Network File System (NFS) protocol on + this mount target. + + + :return: The export_set_id of this MountTargetSummary. + :rtype: str + """ + return self._export_set_id + + @export_set_id.setter + def export_set_id(self, export_set_id): + """ + Sets the export_set_id of this MountTargetSummary. + The OCID of the associated export set. Controls what file + systems will be exported using Network File System (NFS) protocol on + this mount target. + + + :param export_set_id: The export_set_id of this MountTargetSummary. + :type: str + """ + self._export_set_id = export_set_id + + @property + def id(self): + """ + **[Required]** Gets the id of this MountTargetSummary. + The OCID of the mount target. + + + :return: The id of this MountTargetSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this MountTargetSummary. + The OCID of the mount target. + + + :param id: The id of this MountTargetSummary. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this MountTargetSummary. + The current state of the mount target. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this MountTargetSummary. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this MountTargetSummary. + The current state of the mount target. + + + :param lifecycle_state: The lifecycle_state of this MountTargetSummary. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED", "FAILED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def private_ip_ids(self): + """ + **[Required]** Gets the private_ip_ids of this MountTargetSummary. + The OCIDs of the private IP addresses associated with this mount target. + + + :return: The private_ip_ids of this MountTargetSummary. + :rtype: list[str] + """ + return self._private_ip_ids + + @private_ip_ids.setter + def private_ip_ids(self, private_ip_ids): + """ + Sets the private_ip_ids of this MountTargetSummary. + The OCIDs of the private IP addresses associated with this mount target. + + + :param private_ip_ids: The private_ip_ids of this MountTargetSummary. + :type: list[str] + """ + self._private_ip_ids = private_ip_ids + + @property + def subnet_id(self): + """ + **[Required]** Gets the subnet_id of this MountTargetSummary. + The OCID of the subnet the mount target is in. + + + :return: The subnet_id of this MountTargetSummary. + :rtype: str + """ + return self._subnet_id + + @subnet_id.setter + def subnet_id(self, subnet_id): + """ + Sets the subnet_id of this MountTargetSummary. + The OCID of the subnet the mount target is in. + + + :param subnet_id: The subnet_id of this MountTargetSummary. + :type: str + """ + self._subnet_id = subnet_id + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this MountTargetSummary. + The date and time the mount target was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this MountTargetSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this MountTargetSummary. + The date and time the mount target was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this MountTargetSummary. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/snapshot.py b/src/oci/file_storage/models/snapshot.py new file mode 100644 index 0000000000..f6400221e7 --- /dev/null +++ b/src/oci/file_storage/models/snapshot.py @@ -0,0 +1,218 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class Snapshot(object): + + def __init__(self, **kwargs): + """ + Initializes a new Snapshot object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param file_system_id: + The value to assign to the file_system_id property of this Snapshot. + :type file_system_id: str + + :param id: + The value to assign to the id property of this Snapshot. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this Snapshot. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param name: + The value to assign to the name property of this Snapshot. + :type name: str + + :param time_created: + The value to assign to the time_created property of this Snapshot. + :type time_created: datetime + + """ + self.swagger_types = { + 'file_system_id': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'name': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'file_system_id': 'fileSystemId', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'name': 'name', + 'time_created': 'timeCreated' + } + + self._file_system_id = None + self._id = None + self._lifecycle_state = None + self._name = None + self._time_created = None + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this Snapshot. + The OCID of the file system from which the snapshot + was created. + + + :return: The file_system_id of this Snapshot. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this Snapshot. + The OCID of the file system from which the snapshot + was created. + + + :param file_system_id: The file_system_id of this Snapshot. + :type: str + """ + self._file_system_id = file_system_id + + @property + def id(self): + """ + **[Required]** Gets the id of this Snapshot. + The OCID of the snapshot. + + + :return: The id of this Snapshot. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Snapshot. + The OCID of the snapshot. + + + :param id: The id of this Snapshot. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this Snapshot. + The current state of the snapshot. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this Snapshot. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this Snapshot. + The current state of the snapshot. + + + :param lifecycle_state: The lifecycle_state of this Snapshot. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def name(self): + """ + **[Required]** Gets the name of this Snapshot. + Name of the snapshot. This value is immutable. + + Avoid entering confidential information. + + Example: `Sunday` + + + :return: The name of this Snapshot. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Snapshot. + Name of the snapshot. This value is immutable. + + Avoid entering confidential information. + + Example: `Sunday` + + + :param name: The name of this Snapshot. + :type: str + """ + self._name = name + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this Snapshot. + The date and time the snapshot was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this Snapshot. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this Snapshot. + The date and time the snapshot was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this Snapshot. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/snapshot_summary.py b/src/oci/file_storage/models/snapshot_summary.py new file mode 100644 index 0000000000..af87446cb3 --- /dev/null +++ b/src/oci/file_storage/models/snapshot_summary.py @@ -0,0 +1,218 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class SnapshotSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new SnapshotSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param file_system_id: + The value to assign to the file_system_id property of this SnapshotSummary. + :type file_system_id: str + + :param id: + The value to assign to the id property of this SnapshotSummary. + :type id: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this SnapshotSummary. + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param name: + The value to assign to the name property of this SnapshotSummary. + :type name: str + + :param time_created: + The value to assign to the time_created property of this SnapshotSummary. + :type time_created: datetime + + """ + self.swagger_types = { + 'file_system_id': 'str', + 'id': 'str', + 'lifecycle_state': 'str', + 'name': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'file_system_id': 'fileSystemId', + 'id': 'id', + 'lifecycle_state': 'lifecycleState', + 'name': 'name', + 'time_created': 'timeCreated' + } + + self._file_system_id = None + self._id = None + self._lifecycle_state = None + self._name = None + self._time_created = None + + @property + def file_system_id(self): + """ + **[Required]** Gets the file_system_id of this SnapshotSummary. + The OCID of the file system from which the + snapshot was created. + + + :return: The file_system_id of this SnapshotSummary. + :rtype: str + """ + return self._file_system_id + + @file_system_id.setter + def file_system_id(self, file_system_id): + """ + Sets the file_system_id of this SnapshotSummary. + The OCID of the file system from which the + snapshot was created. + + + :param file_system_id: The file_system_id of this SnapshotSummary. + :type: str + """ + self._file_system_id = file_system_id + + @property + def id(self): + """ + **[Required]** Gets the id of this SnapshotSummary. + The OCID of the snapshot. + + + :return: The id of this SnapshotSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this SnapshotSummary. + The OCID of the snapshot. + + + :param id: The id of this SnapshotSummary. + :type: str + """ + self._id = id + + @property + def lifecycle_state(self): + """ + **[Required]** Gets the lifecycle_state of this SnapshotSummary. + The current state of the snapshot. + + Allowed values for this property are: "CREATING", "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this SnapshotSummary. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this SnapshotSummary. + The current state of the snapshot. + + + :param lifecycle_state: The lifecycle_state of this SnapshotSummary. + :type: str + """ + allowed_values = ["CREATING", "ACTIVE", "DELETING", "DELETED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def name(self): + """ + **[Required]** Gets the name of this SnapshotSummary. + Name of the snapshot. This value is immutable. + + Avoid entering confidential information. + + Example: `Sunday` + + + :return: The name of this SnapshotSummary. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this SnapshotSummary. + Name of the snapshot. This value is immutable. + + Avoid entering confidential information. + + Example: `Sunday` + + + :param name: The name of this SnapshotSummary. + :type: str + """ + self._name = name + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this SnapshotSummary. + The date and time the snapshot was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :return: The time_created of this SnapshotSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this SnapshotSummary. + The date and time the snapshot was created, expressed + in `RFC 3339`__ timestamp format. + + Example: `2016-08-25T21:10:29.600Z` + + __ https://tools.ietf.org/rfc/rfc3339 + + + :param time_created: The time_created of this SnapshotSummary. + :type: datetime + """ + self._time_created = time_created + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/update_export_set_details.py b/src/oci/file_storage/models/update_export_set_details.py new file mode 100644 index 0000000000..79ee7e8e37 --- /dev/null +++ b/src/oci/file_storage/models/update_export_set_details.py @@ -0,0 +1,166 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class UpdateExportSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateExportSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param display_name: + The value to assign to the display_name property of this UpdateExportSetDetails. + :type display_name: str + + :param max_fs_stat_bytes: + The value to assign to the max_fs_stat_bytes property of this UpdateExportSetDetails. + :type max_fs_stat_bytes: int + + :param max_fs_stat_files: + The value to assign to the max_fs_stat_files property of this UpdateExportSetDetails. + :type max_fs_stat_files: int + + """ + self.swagger_types = { + 'display_name': 'str', + 'max_fs_stat_bytes': 'int', + 'max_fs_stat_files': 'int' + } + + self.attribute_map = { + 'display_name': 'displayName', + 'max_fs_stat_bytes': 'maxFsStatBytes', + 'max_fs_stat_files': 'maxFsStatFiles' + } + + self._display_name = None + self._max_fs_stat_bytes = None + self._max_fs_stat_files = None + + @property + def display_name(self): + """ + Gets the display_name of this UpdateExportSetDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :return: The display_name of this UpdateExportSetDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this UpdateExportSetDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My export set` + + + :param display_name: The display_name of this UpdateExportSetDetails. + :type: str + """ + self._display_name = display_name + + @property + def max_fs_stat_bytes(self): + """ + Gets the max_fs_stat_bytes of this UpdateExportSetDetails. + Controls the maximum `tbytes`, `fbytes`, and `abytes` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tbytes` value reported by `FSSTAT` will be + `maxFsStatBytes`. The value of `fbytes` and `abytes` will be + `maxFsStatBytes` minus the metered size of the file + system. If the metered size is larger than `maxFsStatBytes`, + then `fbytes` and `abytes` will both be '0'. + + + :return: The max_fs_stat_bytes of this UpdateExportSetDetails. + :rtype: int + """ + return self._max_fs_stat_bytes + + @max_fs_stat_bytes.setter + def max_fs_stat_bytes(self, max_fs_stat_bytes): + """ + Sets the max_fs_stat_bytes of this UpdateExportSetDetails. + Controls the maximum `tbytes`, `fbytes`, and `abytes` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tbytes` value reported by `FSSTAT` will be + `maxFsStatBytes`. The value of `fbytes` and `abytes` will be + `maxFsStatBytes` minus the metered size of the file + system. If the metered size is larger than `maxFsStatBytes`, + then `fbytes` and `abytes` will both be '0'. + + + :param max_fs_stat_bytes: The max_fs_stat_bytes of this UpdateExportSetDetails. + :type: int + """ + self._max_fs_stat_bytes = max_fs_stat_bytes + + @property + def max_fs_stat_files(self): + """ + Gets the max_fs_stat_files of this UpdateExportSetDetails. + Controls the maximum `ffiles`, `ffiles`, and `afiles` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tfiles` value reported by `FSSTAT` will be + `maxFsStatFiles`. The value of `ffiles` and `afiles` will be + `maxFsStatFiles` minus the metered size of the file + system. If the metered size is larger than `maxFsStatFiles`, + then `ffiles` and `afiles` will both be '0'. + + + :return: The max_fs_stat_files of this UpdateExportSetDetails. + :rtype: int + """ + return self._max_fs_stat_files + + @max_fs_stat_files.setter + def max_fs_stat_files(self, max_fs_stat_files): + """ + Sets the max_fs_stat_files of this UpdateExportSetDetails. + Controls the maximum `ffiles`, `ffiles`, and `afiles` + values reported by `NFS FSSTAT` calls through any associated + mount targets. This is an advanced feature. For most + applications, use the default value. The + `tfiles` value reported by `FSSTAT` will be + `maxFsStatFiles`. The value of `ffiles` and `afiles` will be + `maxFsStatFiles` minus the metered size of the file + system. If the metered size is larger than `maxFsStatFiles`, + then `ffiles` and `afiles` will both be '0'. + + + :param max_fs_stat_files: The max_fs_stat_files of this UpdateExportSetDetails. + :type: int + """ + self._max_fs_stat_files = max_fs_stat_files + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/update_file_system_details.py b/src/oci/file_storage/models/update_file_system_details.py new file mode 100644 index 0000000000..4e54dc2db7 --- /dev/null +++ b/src/oci/file_storage/models/update_file_system_details.py @@ -0,0 +1,72 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class UpdateFileSystemDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateFileSystemDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param display_name: + The value to assign to the display_name property of this UpdateFileSystemDetails. + :type display_name: str + + """ + self.swagger_types = { + 'display_name': 'str' + } + + self.attribute_map = { + 'display_name': 'displayName' + } + + self._display_name = None + + @property + def display_name(self): + """ + Gets the display_name of this UpdateFileSystemDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :return: The display_name of this UpdateFileSystemDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this UpdateFileSystemDetails. + A user-friendly name. It does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My file system` + + + :param display_name: The display_name of this UpdateFileSystemDetails. + :type: str + """ + self._display_name = display_name + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/file_storage/models/update_mount_target_details.py b/src/oci/file_storage/models/update_mount_target_details.py new file mode 100644 index 0000000000..d8a2caf5cf --- /dev/null +++ b/src/oci/file_storage/models/update_mount_target_details.py @@ -0,0 +1,72 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + + +from ...util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F401 +from ...decorators import init_model_state_from_kwargs + + +@init_model_state_from_kwargs +class UpdateMountTargetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateMountTargetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param display_name: + The value to assign to the display_name property of this UpdateMountTargetDetails. + :type display_name: str + + """ + self.swagger_types = { + 'display_name': 'str' + } + + self.attribute_map = { + 'display_name': 'displayName' + } + + self._display_name = None + + @property + def display_name(self): + """ + Gets the display_name of this UpdateMountTargetDetails. + A user-friendly name. Does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :return: The display_name of this UpdateMountTargetDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this UpdateMountTargetDetails. + A user-friendly name. Does not have to be unique, and it is changeable. + Avoid entering confidential information. + + Example: `My mount target` + + + :param display_name: The display_name of this UpdateMountTargetDetails. + :type: str + """ + self._display_name = display_name + + def __repr__(self): + return formatted_flat_dict(self) + + def __eq__(self, other): + if other is None: + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not self == other diff --git a/src/oci/object_storage/models/bucket.py b/src/oci/object_storage/models/bucket.py index 55f78e157a..5faf594fdd 100644 --- a/src/oci/object_storage/models/bucket.py +++ b/src/oci/object_storage/models/bucket.py @@ -54,6 +54,14 @@ def __init__(self, **kwargs): Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. :type storage_tier: str + :param freeform_tags: + The value to assign to the freeform_tags property of this Bucket. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this Bucket. + :type defined_tags: dict(str, dict(str, object)) + """ self.swagger_types = { 'namespace': 'str', @@ -64,7 +72,9 @@ def __init__(self, **kwargs): 'time_created': 'datetime', 'etag': 'str', 'public_access_type': 'str', - 'storage_tier': 'str' + 'storage_tier': 'str', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))' } self.attribute_map = { @@ -76,7 +86,9 @@ def __init__(self, **kwargs): 'time_created': 'timeCreated', 'etag': 'etag', 'public_access_type': 'publicAccessType', - 'storage_tier': 'storageTier' + 'storage_tier': 'storageTier', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags' } self._namespace = None @@ -88,6 +100,8 @@ def __init__(self, **kwargs): self._etag = None self._public_access_type = None self._storage_tier = None + self._freeform_tags = None + self._defined_tags = None @property def namespace(self): @@ -307,8 +321,8 @@ def storage_tier(self): Gets the storage_tier of this Bucket. The type of storage tier of this bucket. A bucket is set to 'Standard' tier by default, which means the bucket will be put in the standard storage tier. - When 'Archive' tier type is set explicitly, the bucket is put in the Archive Storage tier. The 'storageTier' - property is immutable once the bucket is created. + When 'Archive' tier type is set explicitly, the bucket is put in the archive storage tier. The 'storageTier' + property is immutable after bucket is created. Allowed values for this property are: "Standard", "Archive", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. @@ -325,8 +339,8 @@ def storage_tier(self, storage_tier): Sets the storage_tier of this Bucket. The type of storage tier of this bucket. A bucket is set to 'Standard' tier by default, which means the bucket will be put in the standard storage tier. - When 'Archive' tier type is set explicitly, the bucket is put in the Archive Storage tier. The 'storageTier' - property is immutable once the bucket is created. + When 'Archive' tier type is set explicitly, the bucket is put in the archive storage tier. The 'storageTier' + property is immutable after bucket is created. :param storage_tier: The storage_tier of this Bucket. @@ -337,6 +351,70 @@ def storage_tier(self, storage_tier): storage_tier = 'UNKNOWN_ENUM_VALUE' self._storage_tier = storage_tier + @property + def freeform_tags(self): + """ + Gets the freeform_tags of this Bucket. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The freeform_tags of this Bucket. + :rtype: dict(str, str) + """ + return self._freeform_tags + + @freeform_tags.setter + def freeform_tags(self, freeform_tags): + """ + Sets the freeform_tags of this Bucket. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param freeform_tags: The freeform_tags of this Bucket. + :type: dict(str, str) + """ + self._freeform_tags = freeform_tags + + @property + def defined_tags(self): + """ + Gets the defined_tags of this Bucket. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The defined_tags of this Bucket. + :rtype: dict(str, dict(str, object)) + """ + return self._defined_tags + + @defined_tags.setter + def defined_tags(self, defined_tags): + """ + Sets the defined_tags of this Bucket. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param defined_tags: The defined_tags of this Bucket. + :type: dict(str, dict(str, object)) + """ + self._defined_tags = defined_tags + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/object_storage/models/bucket_summary.py b/src/oci/object_storage/models/bucket_summary.py index 9308cc5a62..6eae66ba30 100644 --- a/src/oci/object_storage/models/bucket_summary.py +++ b/src/oci/object_storage/models/bucket_summary.py @@ -38,6 +38,14 @@ def __init__(self, **kwargs): The value to assign to the etag property of this BucketSummary. :type etag: str + :param freeform_tags: + The value to assign to the freeform_tags property of this BucketSummary. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this BucketSummary. + :type defined_tags: dict(str, dict(str, object)) + """ self.swagger_types = { 'namespace': 'str', @@ -45,7 +53,9 @@ def __init__(self, **kwargs): 'compartment_id': 'str', 'created_by': 'str', 'time_created': 'datetime', - 'etag': 'str' + 'etag': 'str', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))' } self.attribute_map = { @@ -54,7 +64,9 @@ def __init__(self, **kwargs): 'compartment_id': 'compartmentId', 'created_by': 'createdBy', 'time_created': 'timeCreated', - 'etag': 'etag' + 'etag': 'etag', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags' } self._namespace = None @@ -63,6 +75,8 @@ def __init__(self, **kwargs): self._created_by = None self._time_created = None self._etag = None + self._freeform_tags = None + self._defined_tags = None @property def namespace(self): @@ -214,6 +228,70 @@ def etag(self, etag): """ self._etag = etag + @property + def freeform_tags(self): + """ + Gets the freeform_tags of this BucketSummary. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The freeform_tags of this BucketSummary. + :rtype: dict(str, str) + """ + return self._freeform_tags + + @freeform_tags.setter + def freeform_tags(self, freeform_tags): + """ + Sets the freeform_tags of this BucketSummary. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param freeform_tags: The freeform_tags of this BucketSummary. + :type: dict(str, str) + """ + self._freeform_tags = freeform_tags + + @property + def defined_tags(self): + """ + Gets the defined_tags of this BucketSummary. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The defined_tags of this BucketSummary. + :rtype: dict(str, dict(str, object)) + """ + return self._defined_tags + + @defined_tags.setter + def defined_tags(self, defined_tags): + """ + Sets the defined_tags of this BucketSummary. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param defined_tags: The defined_tags of this BucketSummary. + :type: dict(str, dict(str, object)) + """ + self._defined_tags = defined_tags + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/object_storage/models/create_bucket_details.py b/src/oci/object_storage/models/create_bucket_details.py index b6487cdbb1..5b0f4d4461 100644 --- a/src/oci/object_storage/models/create_bucket_details.py +++ b/src/oci/object_storage/models/create_bucket_details.py @@ -36,13 +36,23 @@ def __init__(self, **kwargs): Allowed values for this property are: "Standard", "Archive" :type storage_tier: str + :param freeform_tags: + The value to assign to the freeform_tags property of this CreateBucketDetails. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this CreateBucketDetails. + :type defined_tags: dict(str, dict(str, object)) + """ self.swagger_types = { 'name': 'str', 'compartment_id': 'str', 'metadata': 'dict(str, str)', 'public_access_type': 'str', - 'storage_tier': 'str' + 'storage_tier': 'str', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))' } self.attribute_map = { @@ -50,7 +60,9 @@ def __init__(self, **kwargs): 'compartment_id': 'compartmentId', 'metadata': 'metadata', 'public_access_type': 'publicAccessType', - 'storage_tier': 'storageTier' + 'storage_tier': 'storageTier', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags' } self._name = None @@ -58,6 +70,8 @@ def __init__(self, **kwargs): self._metadata = None self._public_access_type = None self._storage_tier = None + self._freeform_tags = None + self._defined_tags = None @property def name(self): @@ -213,6 +227,70 @@ def storage_tier(self, storage_tier): ) self._storage_tier = storage_tier + @property + def freeform_tags(self): + """ + Gets the freeform_tags of this CreateBucketDetails. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The freeform_tags of this CreateBucketDetails. + :rtype: dict(str, str) + """ + return self._freeform_tags + + @freeform_tags.setter + def freeform_tags(self, freeform_tags): + """ + Sets the freeform_tags of this CreateBucketDetails. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param freeform_tags: The freeform_tags of this CreateBucketDetails. + :type: dict(str, str) + """ + self._freeform_tags = freeform_tags + + @property + def defined_tags(self): + """ + Gets the defined_tags of this CreateBucketDetails. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The defined_tags of this CreateBucketDetails. + :rtype: dict(str, dict(str, object)) + """ + return self._defined_tags + + @defined_tags.setter + def defined_tags(self, defined_tags): + """ + Sets the defined_tags of this CreateBucketDetails. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param defined_tags: The defined_tags of this CreateBucketDetails. + :type: dict(str, dict(str, object)) + """ + self._defined_tags = defined_tags + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/object_storage/models/restore_objects_details.py b/src/oci/object_storage/models/restore_objects_details.py index 755bab5727..d4252c1c76 100644 --- a/src/oci/object_storage/models/restore_objects_details.py +++ b/src/oci/object_storage/models/restore_objects_details.py @@ -18,16 +18,23 @@ def __init__(self, **kwargs): The value to assign to the object_name property of this RestoreObjectsDetails. :type object_name: str + :param hours: + The value to assign to the hours property of this RestoreObjectsDetails. + :type hours: int + """ self.swagger_types = { - 'object_name': 'str' + 'object_name': 'str', + 'hours': 'int' } self.attribute_map = { - 'object_name': 'objectName' + 'object_name': 'objectName', + 'hours': 'hours' } self._object_name = None + self._hours = None @property def object_name(self): @@ -53,6 +60,32 @@ def object_name(self, object_name): """ self._object_name = object_name + @property + def hours(self): + """ + Gets the hours of this RestoreObjectsDetails. + The number of hours for which this object will be restored. + By default object will be restored for 24 hours.It can be configured using hours parameter. + + + :return: The hours of this RestoreObjectsDetails. + :rtype: int + """ + return self._hours + + @hours.setter + def hours(self, hours): + """ + Sets the hours of this RestoreObjectsDetails. + The number of hours for which this object will be restored. + By default object will be restored for 24 hours.It can be configured using hours parameter. + + + :param hours: The hours of this RestoreObjectsDetails. + :type: int + """ + self._hours = hours + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/object_storage/models/update_bucket_details.py b/src/oci/object_storage/models/update_bucket_details.py index 01ea009e1f..16e6548f44 100644 --- a/src/oci/object_storage/models/update_bucket_details.py +++ b/src/oci/object_storage/models/update_bucket_details.py @@ -35,13 +35,23 @@ def __init__(self, **kwargs): Allowed values for this property are: "NoPublicAccess", "ObjectRead", "ObjectReadWithoutList" :type public_access_type: str + :param freeform_tags: + The value to assign to the freeform_tags property of this UpdateBucketDetails. + :type freeform_tags: dict(str, str) + + :param defined_tags: + The value to assign to the defined_tags property of this UpdateBucketDetails. + :type defined_tags: dict(str, dict(str, object)) + """ self.swagger_types = { 'namespace': 'str', 'compartment_id': 'str', 'name': 'str', 'metadata': 'dict(str, str)', - 'public_access_type': 'str' + 'public_access_type': 'str', + 'freeform_tags': 'dict(str, str)', + 'defined_tags': 'dict(str, dict(str, object))' } self.attribute_map = { @@ -49,7 +59,9 @@ def __init__(self, **kwargs): 'compartment_id': 'compartmentId', 'name': 'name', 'metadata': 'metadata', - 'public_access_type': 'publicAccessType' + 'public_access_type': 'publicAccessType', + 'freeform_tags': 'freeformTags', + 'defined_tags': 'definedTags' } self._namespace = None @@ -57,6 +69,8 @@ def __init__(self, **kwargs): self._name = None self._metadata = None self._public_access_type = None + self._freeform_tags = None + self._defined_tags = None @property def namespace(self): @@ -194,6 +208,70 @@ def public_access_type(self, public_access_type): ) self._public_access_type = public_access_type + @property + def freeform_tags(self): + """ + Gets the freeform_tags of this UpdateBucketDetails. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The freeform_tags of this UpdateBucketDetails. + :rtype: dict(str, str) + """ + return self._freeform_tags + + @freeform_tags.setter + def freeform_tags(self, freeform_tags): + """ + Sets the freeform_tags of this UpdateBucketDetails. + Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + For more information, see `Resource Tags`__. + Example: `{\"Department\": \"Finance\"}` + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param freeform_tags: The freeform_tags of this UpdateBucketDetails. + :type: dict(str, str) + """ + self._freeform_tags = freeform_tags + + @property + def defined_tags(self): + """ + Gets the defined_tags of this UpdateBucketDetails. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}} + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :return: The defined_tags of this UpdateBucketDetails. + :rtype: dict(str, dict(str, object)) + """ + return self._defined_tags + + @defined_tags.setter + def defined_tags(self, defined_tags): + """ + Sets the defined_tags of this UpdateBucketDetails. + Defined tags for this resource. Each key is predefined and scoped to a namespace. + For more information, see `Resource Tags`__. + Example: `{\"Operations\": {\"CostCenter\": \"42\"}} + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm + + + :param defined_tags: The defined_tags of this UpdateBucketDetails. + :type: dict(str, dict(str, object)) + """ + self._defined_tags = defined_tags + def __repr__(self): return formatted_flat_dict(self) diff --git a/src/oci/object_storage/object_storage_client.py b/src/oci/object_storage/object_storage_client.py index b900b27c24..9682dbd0c2 100644 --- a/src/oci/object_storage/object_storage_client.py +++ b/src/oci/object_storage/object_storage_client.py @@ -1176,6 +1176,13 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): :param str page: (optional) The page at which to start retrieving results. + :param list[str] fields: (optional) + Bucket summary in list of buckets includes the 'namespace', 'name', 'compartmentId', 'createdBy', 'timeCreated', + and 'etag' fields. This parameter can also include 'tags' (freeformTags and definedTags). The only supported value + of this parameter is 'tags' for now. Example 'tags'. + + Allowed values are: "tags" + :param str opc_client_request_id: (optional) The client request ID for tracing. @@ -1190,6 +1197,7 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): "retry_strategy", "limit", "page", + "fields", "opc_client_request_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] @@ -1207,10 +1215,19 @@ def list_buckets(self, namespace_name, compartment_id, **kwargs): if v is None or (isinstance(v, six.string_types) and len(v.strip()) == 0): raise ValueError('Parameter {} cannot be None, whitespace or empty string'.format(k)) + if 'fields' in kwargs: + fields_allowed_values = ["tags"] + for fields_item in kwargs['fields']: + if fields_item not in fields_allowed_values: + raise ValueError( + "Invalid value for `fields`, must be one of {0}".format(fields_allowed_values) + ) + query_params = { "compartmentId": compartment_id, "limit": kwargs.get("limit", missing), - "page": kwargs.get("page", missing) + "page": kwargs.get("page", missing), + "fields": self.base_client.generate_collection_format_param(kwargs.get("fields", missing), 'csv') } query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} @@ -1821,6 +1838,7 @@ def restore_objects(self, namespace_name, bucket_name, restore_objects_details, """ RestoreObjects Restore one or more objects specified by objectName parameter. + By default object will be restored for 24 hours.Duration can be configured using hours parameter. :param str namespace_name: (required) diff --git a/src/oci/pagination/pagination_utils.py b/src/oci/pagination/pagination_utils.py index 3e63918a34..6535d63fe8 100644 --- a/src/oci/pagination/pagination_utils.py +++ b/src/oci/pagination/pagination_utils.py @@ -1,6 +1,7 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +from .. import dns from .. import retry from ..response import Response @@ -33,11 +34,25 @@ def list_call_get_up_to_limit(list_func_ref, record_limit, page_size, *list_func """ call_result = None aggregated_results = [] + is_dns_record_collection = False for response in list_call_get_up_to_limit_generator(list_func_ref, record_limit, page_size, 'response', *list_func_args, **list_func_kwargs): call_result = response - aggregated_results.extend(call_result.data) - final_response = Response(call_result.status, call_result.headers, aggregated_results, call_result.request) + if isinstance(call_result.data, dns.models.RecordCollection): + is_dns_record_collection = True + aggregated_results.extend(call_result.data.items) + else: + aggregated_results.extend(call_result.data) + + if is_dns_record_collection: + final_response = Response( + call_result.status, + call_result.headers, + dns.models.RecordCollection(items=aggregated_results), + call_result.request + ) + else: + final_response = Response(call_result.status, call_result.headers, aggregated_results, call_result.request) return final_response @@ -88,7 +103,13 @@ def list_call_get_up_to_limit_generator(list_func_ref, record_limit, page_size, if yield_mode == 'response': yield single_call_result else: - for item in single_call_result.data: + items_to_yield = [] + if isinstance(single_call_result.data, dns.models.RecordCollection): + items_to_yield = single_call_result.data.items + else: + items_to_yield = single_call_result.data + + for item in items_to_yield: yield item return # This will terminate after we yield everything we can from the single result @@ -104,10 +125,19 @@ def list_call_get_up_to_limit_generator(list_func_ref, record_limit, page_size, if yield_mode == 'response': yield call_result else: - for item in call_result.data: + items_to_yield = [] + if isinstance(call_result.data, dns.models.RecordCollection): + items_to_yield = call_result.data.items + else: + items_to_yield = call_result.data + + for item in items_to_yield: yield item - remaining_items_to_fetch -= len(call_result.data) + if isinstance(call_result.data, dns.models.RecordCollection): + remaining_items_to_fetch -= len(call_result.data.items) + else: + remaining_items_to_fetch -= len(call_result.data) if call_result.next_page is not None: list_func_kwargs['page'] = call_result.next_page @@ -136,11 +166,24 @@ def list_call_get_all_results(list_func_ref, *list_func_args, **list_func_kwargs aggregated_results = [] call_result = None + is_dns_record_collection = False for response in list_call_get_all_results_generator(list_func_ref, 'response', *list_func_args, **list_func_kwargs): call_result = response - aggregated_results.extend(call_result.data) - - final_response = Response(call_result.status, call_result.headers, aggregated_results, call_result.request) + if isinstance(call_result.data, dns.models.RecordCollection): + is_dns_record_collection = True + aggregated_results.extend(call_result.data.items) + else: + aggregated_results.extend(call_result.data) + + if is_dns_record_collection: + final_response = Response( + call_result.status, + call_result.headers, + dns.models.RecordCollection(items=aggregated_results), + call_result.request + ) + else: + final_response = Response(call_result.status, call_result.headers, aggregated_results, call_result.request) return final_response @@ -180,7 +223,13 @@ def list_call_get_all_results_generator(list_func_ref, yield_mode, *list_func_ar if yield_mode == 'response': yield call_result else: - for item in call_result.data: + items_to_yield = [] + if isinstance(call_result.data, dns.models.RecordCollection): + items_to_yield = call_result.data.items + else: + items_to_yield = call_result.data + + for item in items_to_yield: yield item if call_result.next_page is not None: diff --git a/src/oci/service_endpoints.py b/src/oci/service_endpoints.py index 392140d44a..bbcfa70d49 100644 --- a/src/oci/service_endpoints.py +++ b/src/oci/service_endpoints.py @@ -8,6 +8,7 @@ "virtual_network": "https://iaas.{domain}/20160918", "database": "https://database.{domain}/20160918", "dns": "https://dns.{domain}/20180115", + "file_storage": "https://filestorage.{domain}/20171215", "identity": "https://identity.{domain}/20160918", "load_balancer": "https://iaas.{domain}/20170115", "object_storage": "https://objectstorage.{domain}" diff --git a/src/oci/version.py b/src/oci/version.py index 98327955d7..f89058227c 100644 --- a/src/oci/version.py +++ b/src/oci/version.py @@ -1,4 +1,4 @@ # coding: utf-8 # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. -__version__ = "1.3.14" +__version__ = "1.3.15" diff --git a/tests/conftest.py b/tests/conftest.py index 60c1a4806d..e95ad85721 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -117,6 +117,12 @@ def dns_client(config): return client +@pytest.fixture +def file_storage_client(config): + client = oci.file_storage.FileStorageClient(config) + return client + + def add_retries_to_service_operations(client_obj): for name in dir(client_obj): if name.find('__') == 0: