From 35e66f2b981f82eb113447aad3197e5ebee7624d Mon Sep 17 00:00:00 2001 From: Mike Ross Date: Thu, 8 Feb 2018 21:19:43 +0000 Subject: [PATCH] Releasing version 1.3.14 --- CHANGELOG.rst | 24 + docs/api/index.rst | 22 + examples/dns_service_example.py | 454 +++++ .../load_balancer_path_route_sets_example.py | 341 ++++ examples/reserved_public_ip_example.py | 273 +++ examples/volume_backup_policy_example.py | 59 + src/oci/__init__.py | 4 +- src/oci/base_client.py | 6 +- src/oci/core/blockstorage_client.py | 331 ++++ src/oci/core/compute_client.py | 9 +- src/oci/core/models/__init__.py | 18 + .../models/attach_i_scsi_volume_details.py | 7 + src/oci/core/models/attach_volume_details.py | 31 + .../core/models/create_public_ip_details.py | 194 ++ src/oci/core/models/create_vnic_details.py | 22 +- .../models/create_volume_backup_details.py | 40 + ...volume_backup_policy_assignment_details.py | 97 + src/oci/core/models/create_volume_details.py | 33 + .../get_public_ip_by_ip_address_details.py | 68 + .../get_public_ip_by_private_ip_id_details.py | 66 + .../core/models/i_scsi_volume_attachment.py | 7 + src/oci/core/models/public_ip.py | 433 +++++ .../core/models/update_public_ip_details.py | 107 ++ src/oci/core/models/volume_attachment.py | 31 + src/oci/core/models/volume_backup.py | 117 ++ src/oci/core/models/volume_backup_policy.py | 161 ++ .../models/volume_backup_policy_assignment.py | 159 ++ src/oci/core/models/volume_backup_schedule.py | 175 ++ src/oci/core/virtual_network_client.py | 521 +++++- src/oci/database/database_client.py | 11 +- src/oci/dns/__init__.py | 10 + src/oci/dns/dns_client.py | 1634 +++++++++++++++++ src/oci/dns/models/__init__.py | 43 + src/oci/dns/models/create_zone_details.py | 168 ++ src/oci/dns/models/external_master.py | 124 ++ .../models/patch_domain_records_details.py | 62 + src/oci/dns/models/patch_rr_set_details.py | 62 + .../dns/models/patch_zone_records_details.py | 62 + src/oci/dns/models/record.py | 264 +++ src/oci/dns/models/record_collection.py | 62 + src/oci/dns/models/record_details.py | 264 +++ src/oci/dns/models/record_operation.py | 334 ++++ src/oci/dns/models/rr_set.py | 62 + src/oci/dns/models/tsig.py | 136 ++ .../models/update_domain_records_details.py | 62 + src/oci/dns/models/update_rr_set_details.py | 62 + src/oci/dns/models/update_zone_details.py | 66 + .../dns/models/update_zone_records_details.py | 62 + src/oci/dns/models/zone.py | 371 ++++ src/oci/dns/models/zone_summary.py | 301 +++ src/oci/identity/identity_client.py | 1 + .../models/create_dynamic_group_details.py | 10 +- src/oci/identity/models/dynamic_group.py | 6 + .../models/update_dynamic_group_details.py | 10 +- src/oci/load_balancer/load_balancer_client.py | 376 ++++ src/oci/load_balancer/models/__init__.py | 12 + .../models/create_listener_details.py | 37 + .../models/create_load_balancer_details.py | 27 + .../models/create_path_route_set_details.py | 103 ++ src/oci/load_balancer/models/listener.py | 37 + .../load_balancer/models/listener_details.py | 37 + src/oci/load_balancer/models/load_balancer.py | 27 + .../load_balancer/models/path_match_type.py | 104 ++ src/oci/load_balancer/models/path_route.py | 148 ++ .../load_balancer/models/path_route_set.py | 101 + .../models/path_route_set_details.py | 66 + .../models/update_listener_details.py | 37 + .../models/update_path_route_set_details.py | 66 + src/oci/service_endpoints.py | 1 + src/oci/version.py | 2 +- src/oci/waiter.py | 3 +- tests/conftest.py | 7 + tests/integ/util.py | 11 +- tests/unit/test_basic_api_calls.py | 20 + 74 files changed, 9255 insertions(+), 26 deletions(-) create mode 100644 examples/dns_service_example.py create mode 100644 examples/load_balancer_path_route_sets_example.py create mode 100644 examples/reserved_public_ip_example.py create mode 100644 examples/volume_backup_policy_example.py create mode 100644 src/oci/core/models/create_public_ip_details.py create mode 100644 src/oci/core/models/create_volume_backup_policy_assignment_details.py create mode 100644 src/oci/core/models/get_public_ip_by_ip_address_details.py create mode 100644 src/oci/core/models/get_public_ip_by_private_ip_id_details.py create mode 100644 src/oci/core/models/public_ip.py create mode 100644 src/oci/core/models/update_public_ip_details.py create mode 100644 src/oci/core/models/volume_backup_policy.py create mode 100644 src/oci/core/models/volume_backup_policy_assignment.py create mode 100644 src/oci/core/models/volume_backup_schedule.py create mode 100644 src/oci/dns/__init__.py create mode 100644 src/oci/dns/dns_client.py create mode 100644 src/oci/dns/models/__init__.py create mode 100644 src/oci/dns/models/create_zone_details.py create mode 100644 src/oci/dns/models/external_master.py create mode 100644 src/oci/dns/models/patch_domain_records_details.py create mode 100644 src/oci/dns/models/patch_rr_set_details.py create mode 100644 src/oci/dns/models/patch_zone_records_details.py create mode 100644 src/oci/dns/models/record.py create mode 100644 src/oci/dns/models/record_collection.py create mode 100644 src/oci/dns/models/record_details.py create mode 100644 src/oci/dns/models/record_operation.py create mode 100644 src/oci/dns/models/rr_set.py create mode 100644 src/oci/dns/models/tsig.py create mode 100644 src/oci/dns/models/update_domain_records_details.py create mode 100644 src/oci/dns/models/update_rr_set_details.py create mode 100644 src/oci/dns/models/update_zone_details.py create mode 100644 src/oci/dns/models/update_zone_records_details.py create mode 100644 src/oci/dns/models/zone.py create mode 100644 src/oci/dns/models/zone_summary.py create mode 100644 src/oci/load_balancer/models/create_path_route_set_details.py create mode 100644 src/oci/load_balancer/models/path_match_type.py create mode 100644 src/oci/load_balancer/models/path_route.py create mode 100644 src/oci/load_balancer/models/path_route_set.py create mode 100644 src/oci/load_balancer/models/path_route_set_details.py create mode 100644 src/oci/load_balancer/models/update_path_route_set_details.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ce8c7ab7a2..d75e126945 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file. The format is based on `Keep a Changelog `_. +==================== +1.3.14 - 2018-02-08 +==================== + +Added +----- +* Support for Domain Name System Service + + * An example on using the Domain Name System Service can be found on `GitHub `_. + +* Support for reserved public IPs in Virtual Networking Service + + * An example on using this functionality can be found on `GitHub `_. + +* Support for path route sets in Load Balancing Service + + * An example on using this functionality can be found on `GitHub `_. + +* Support for automated and policy-based backups, read-only volume attachments, and incremental backups in Block Storage Service + + * An example on using policy-based backups can be found on `GitHub `_. + +* Support for filtering by ``backupId`` in ``ListDbSystems`` operation in Database Service + ==================== 1.3.13 - 2018-01-25 ==================== diff --git a/docs/api/index.rst b/docs/api/index.rst index 166c5fef34..e6c67fa0ae 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -95,6 +95,28 @@ Virtual Network :imported-members: :inherited-members: +========== + DNS +========== + +-------- + Client +-------- + +.. autoclass:: oci.dns.dns_client.DnsClient + :members: + +-------- + Models +-------- + +.. automodule:: oci.dns.models + :special-members: __init__ + :members: + :undoc-members: + :imported-members: + :inherited-members: + ========== Identity ========== diff --git a/examples/dns_service_example.py b/examples/dns_service_example.py new file mode 100644 index 0000000000..76ca157e47 --- /dev/null +++ b/examples/dns_service_example.py @@ -0,0 +1,454 @@ +# 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 DNS service in the Python SDK. This script accepts two +# arguments: +# +# * The first argument is the OCID of the compartment where we'll create a DNS zone +# * The second is the name of the DNS zone to create (e.g. my-example-zone.com) + +import oci +import sys + + +def get_all_zone_records(dns_client, zone_name, zone_version): + all_records = [] + all_records_generator = oci.pagination.list_call_get_all_results_generator( + dns_client.get_zone_records, + 'response', # Iterate through the raw responses + zone_name, + zone_version=zone_version + ) + for response in all_records_generator: + # Each response contains a header which has the total number of records. This can + # be accessed via: + # response.headers.get('opc-total-items') + all_records.extend(response.data.items) + + return all_records + + +def get_all_domain_records(dns_client, zone_name, domain, zone_version): + all_records = [] + all_records_generator = oci.pagination.list_call_get_all_results_generator( + dns_client.get_domain_records, + 'response', # Iterate through the raw responses + zone_name, + domain, + zone_version=zone_version + ) + for response in all_records_generator: + all_records.extend(response.data.items) + + return all_records + + +def get_all_rr_set_records(dns_client, zone_name, domain, zone_version, rtype): + all_records = [] + all_records_generator = oci.pagination.list_call_get_all_results_generator( + dns_client.get_rr_set, + 'response', # Iterate through the raw responses + zone_name, + domain, + rtype, + zone_version=zone_version + ) + for response in all_records_generator: + all_records.extend(response.data.items) + + return all_records + + +def get_zone(dns_client, zone_name): + return dns_client.get_zone(zone_name).data + + +# Default config file and profile +config = oci.config.from_file() +dns_client = oci.dns.DnsClient(config) + +if len(sys.argv) != 3: + raise RuntimeError('This script expects an argument of a compartment OCID where the zone will be created, and the name of the zone') + +# The first argument is the name of the script, so start the index at 1 +compartment_id = sys.argv[1] +zone_name = sys.argv[2] + +create_response = dns_client.create_zone( + oci.dns.models.CreateZoneDetails( + name=zone_name, + zone_type='PRIMARY', + compartment_id=compartment_id + ) +) + +print('Created zone:\n{}'.format(create_response.data)) +print('\n=========================\n') + +# This will just get all the zones +all_zones = oci.pagination.list_call_get_all_results(dns_client.list_zones, compartment_id) +print('All zones:\n{}'.format(all_zones.data)) + +# We can also provide filter conditions and sort order to the list_zones operation. Here we filter based +# on an exact name match and filter by the time the zone was created descending +zones_matching_name = oci.pagination.list_call_get_all_results( + dns_client.list_zones, + compartment_id, + name=zone_name, + sort_by='timeCreated', + sort_order='DESC' +) +print('All zones with sort and filter:\n{}'.format(zones_matching_name.data)) +print('\n=========================\n') + +# We can update records in the zone. This will overwrite any existing records so if there are items +# we wish to keep (e.g. the NS records in the zone) we need to read those out first and make +# sure they are included in the update. +# +# Note, also, that when updating zone records we can add records with different rtypes and also +# for different domains in the zone + +# get_zone_records is a paginated operation, so we can use operations in the oci.pagination module +# to handle getting pages of data for us, rather than handling page tokens ourselves. We're also +# supplying some additional filter criteria to get_zone_records to narrow down what gets returned +original_zone_ns_records_generator = oci.pagination.list_call_get_all_results_generator( + dns_client.get_zone_records, + 'response', + zone_name, + zone_version=zones_matching_name.data[0].version, # Make sure we use the correct version when getting records + domain=zone_name, + compartment_id=compartment_id, + rtype='NS' +) +original_ns_records = [] +for response in original_zone_ns_records_generator: + original_ns_records.extend(response.data.items) + +print('Original NS records:\n{}'.format(original_ns_records)) + +# Here we prepare our update - this will include the NS records, plus a TXT record for the top level +# domain and an A record for a subdomain +update_zone_records = [] +for ns_record in original_ns_records: + update_zone_records.append( + oci.dns.models.RecordDetails( + domain=ns_record.domain, + ttl=ns_record.ttl, + rtype='NS', + record_hash=ns_record.record_hash, + rdata=ns_record.rdata, + rrset_version=ns_record.rrset_version, + is_protected=True + ) + ) +update_zone_records.extend([ + oci.dns.models.RecordDetails( + domain=zone_name, + ttl=30, + rtype='TXT', + rdata='Some textual data' + ), + oci.dns.models.RecordDetails( + domain='testsubdomain1.{}'.format(zone_name), + ttl=1800, + rtype='A', + rdata='127.0.0.1' + ) +]) + +dns_client.update_zone_records( + zone_name, + oci.dns.models.UpdateZoneRecordsDetails(items=update_zone_records) +) + +# When retrieving records, we can optionally specify what version of the zone we want records for. In this case, +# we explicitly want the latest version, which we can get by retrieving the zone and then interrogating its +# version. Specifying different versions is also possible +records_after_update = get_all_zone_records( + dns_client, + zone_name, + get_zone(dns_client, zone_name).version +) +print('Updated zone records:\n{}'.format(records_after_update)) +print('\n=========================\n') + +# In addition to updates, we can use the patch operation to add and remove records from the zone without +# having to send through the complete list of records each time. In this example, we'll remove the existing +# TXT record and add a new one in + +txt_record = None +for record in records_after_update: + if record.rtype == 'TXT': + txt_record = record + break + +patch_add_remove_txt_record = [ + oci.dns.models.RecordOperation( + domain=zone_name, + record_hash=txt_record.record_hash, + rtype='TXT', + rdata=txt_record.rdata, + operation='REMOVE' + ), + oci.dns.models.RecordOperation( + domain=zone_name, + rtype='TXT', + ttl=45, + rdata='Patch new text data', + operation='ADD' + ) +] +dns_client.patch_zone_records( + zone_name, + oci.dns.models.PatchZoneRecordsDetails(items=patch_add_remove_txt_record) +) + +records_after_patch = get_all_zone_records( + dns_client, + zone_name, + get_zone(dns_client, zone_name).version +) +print('Zone records after patch:\n{}'.format(records_after_patch)) +print('\n=========================\n') + +# As part of patch operations, we can also specify preconditions (REQUIRE - data must be present, and +# PROHIBIT - data must not be present) which must be met for the operation to succeed. +# +# As of the time of writing (6 February 2018), these preconditions cannot contain rdata or record_hash +# fields + +a_record = None +for record in records_after_update: + if record.rtype == 'A': + a_record = record + break + +failing_patch_operation = [ + oci.dns.models.RecordOperation( # This will fail as nothing matches this criteria + domain='testsubdomain1.{}'.format(zone_name), + rtype='A', + rrset_version='1234567', + operation='REQUIRE' + ), + oci.dns.models.RecordOperation( + domain='testsubdomain1.{}'.format(zone_name), + rtype='A', + ttl=1800, + rdata='127.0.0.2', + operation='ADD' + ) +] + +try: + dns_client.patch_zone_records( + zone_name, + oci.dns.models.PatchZoneRecordsDetails(items=failing_patch_operation) + ) +except oci.exceptions.ServiceError as e: + print('Patch with bad precondition failed with status: {}'.format(e.status)) + +# This operation will succeed since we're asking that something matching the criteria doesn't exist (PROHIBIT). Note +# also that the TTL will be applied to all other A records in the domain (i.e. our existing A record will have its +# TTL changed to 2100) +successful_patch_operation = [ + oci.dns.models.RecordOperation( + domain='testsubdomain1.{}'.format(zone_name), + rtype='A', + rrset_version='1234567', + operation='PROHIBIT' + ), + oci.dns.models.RecordOperation( + domain='testsubdomain1.{}'.format(zone_name), + rtype='A', + ttl=2100, + rdata='127.0.0.2', + operation='ADD' + ) +] + +dns_client.patch_zone_records( + zone_name, + oci.dns.models.PatchZoneRecordsDetails(items=successful_patch_operation) +) + +records_after_patch = get_all_zone_records( + dns_client, + zone_name, + get_zone(dns_client, zone_name).version +) +print('Zone records after patch with preconditions:\n{}'.format(records_after_patch)) +print('\n=========================\n') + +# We can also do update and patch operations at the domain level. This can handle records with different rtypes +# but they must all be in the same domain + +subdomain = "testsubdomain2.{}".format(zone_name) +all_domain_records = get_all_domain_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version) + +# Initially the domain should not have any records +print('Current domain records: {}'.format(all_domain_records)) + +update_domain_records = [ + oci.dns.models.RecordDetails( + domain=subdomain, + ttl=30, + rtype='TXT', + rdata='Subdomain text' + ), + oci.dns.models.RecordDetails( + domain=subdomain, + ttl=900, + rtype='A', + rdata='127.0.0.7' + ) +] + +dns_client.update_domain_records( + zone_name, + subdomain, + oci.dns.models.UpdateDomainRecordsDetails(items=update_domain_records) +) + +all_domain_records = get_all_domain_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version) +print('Domain records after update:\n{}'.format(all_domain_records)) + +a_record = None +txt_record = None +for record in all_domain_records: + if record.rtype == 'A': + a_record = record + elif record.rtype == 'TXT': + txt_record = record + +# Patch operations at the domain level function similarly to patch operations at the zone level, in that we can send through +# partial updates (additions and removals) and also specify preconditions +# +# Here we specify two preconditions (which should succeed): +# * TXT records match the given RRSet version +# * A records have the given TTL +# +# And if that is successful we'll update the TTL of the existing A record +domain_patch_operations = [ + oci.dns.models.RecordOperation( + domain=subdomain, + rtype='TXT', + rrset_version=txt_record.rrset_version, + operation='REQUIRE' + ), + oci.dns.models.RecordOperation( + domain=subdomain, + rtype='A', + ttl=a_record.ttl, + operation='REQUIRE' + ), + oci.dns.models.RecordOperation( + domain=subdomain, + ttl=1000, + rtype='A', + rdata='127.0.0.7', + operation='ADD' + ) +] + +dns_client.patch_domain_records( + zone_name, + subdomain, + oci.dns.models.PatchDomainRecordsDetails(items=domain_patch_operations) +) + +all_domain_records = get_all_domain_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version) +print('Domain records after patch:\n{}'.format(all_domain_records)) +print('\n=========================\n') + +# We can also delete records from the domain +dns_client.delete_domain_records(zone_name, subdomain) + +all_domain_records = get_all_domain_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version) +print('Domain records after delete:\n{}'.format(all_domain_records)) +print('\n=========================\n') + +# We can also do update and patch operations at the RRSet level. This is scoped to a particular domain and rtype. + +subdomain = 'testsubdomain3.{}'.format(zone_name) + +all_rr_set_records = get_all_rr_set_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version, 'TXT') + +# Initially the RRSet should not have any records as we're using a "fresh" subdomain +print('Current RRSet records: {}'.format(all_rr_set_records)) + +update_rr_set = [ + oci.dns.models.RecordDetails( + domain=subdomain, + rtype='TXT', + ttl=100, # TTL should be consistent on each RecordDetails + rdata='rec1' + ), + oci.dns.models.RecordDetails( + domain=subdomain, + rtype='TXT', + ttl=100, + rdata='rec2' + ) +] + +dns_client.update_rr_set( + zone_name, + subdomain, + 'TXT', + oci.dns.models.UpdateRRSetDetails(items=update_rr_set) +) + +all_rr_set_records = get_all_rr_set_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version, 'TXT') +print('RRSet records after update: {}'.format(all_rr_set_records)) + +# Patch operations on RRSets function similar to elsewhere in that we can send through +# partial updates (additions and removals) and also specify preconditions. +# +# Here we specify a precondition on the TTL, and also remove one record and add another. Note that the new TTL specified +# will apply to all records + +patch_rr_set_operations = [ + oci.dns.models.RecordOperation( + domain=subdomain, + rtype='TXT', + ttl=101, + operation='PROHIBIT' + ), + oci.dns.models.RecordOperation( + domain=subdomain, + rtype='TXT', + record_hash=all_rr_set_records[1].record_hash, + # Currently (as of 6 Feb 2018) for a TXT record, if you want to send in rdata for an EXISTING record then it should be quoted. For example: + # - '"Hello" "World"' instead of 'Hello World' + # - '"rec3"' instead of 'rec3' + rdata=all_rr_set_records[1].rdata, + operation='REMOVE' + ), + oci.dns.models.RecordOperation( + domain=subdomain, + rtype='TXT', + ttl=101, + rdata='rec3', # For new TXT records, we don't need to quote it + operation='ADD' + ) +] + +dns_client.patch_rr_set( + zone_name, + subdomain, + 'TXT', + oci.dns.models.PatchRRSetDetails(items=patch_rr_set_operations) +) + +all_rr_set_records = get_all_rr_set_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version, 'TXT') +print('RRSet records after patch: {}'.format(all_rr_set_records)) + +# We can also delete records from the RRSet +dns_client.delete_rr_set(zone_name, subdomain, 'TXT') + +all_rr_set_records = get_all_rr_set_records(dns_client, zone_name, subdomain, get_zone(dns_client, zone_name).version, 'TXT') +print('RRSet records after delete: {}'.format(all_rr_set_records)) +print('\n=========================\n') + +dns_client.delete_zone(zone_name) +print('Deleted zone') diff --git a/examples/load_balancer_path_route_sets_example.py b/examples/load_balancer_path_route_sets_example.py new file mode 100644 index 0000000000..c75a666772 --- /dev/null +++ b/examples/load_balancer_path_route_sets_example.py @@ -0,0 +1,341 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example on how to work with path route sets on a load balancer by: +# +# - Creating path route sets when the load balancer is created +# - Creating/updating path route after a load balancer has been created (via the CreatePathRouteSet and UpdatePathRouteSet operations) +# - Creating and updating listeners with path route sets +# +# This script accepts three arguments: +# - The first argument is the compartment where we'll create the load balancer and related resources +# - The second argument is the first availability domain where we'll create a subnet +# - The third argument is a second (different) availability domain where we'll create a subnet +# +# A load balancer needs some backing networking resources (at least a VCN and two subnets). For demonstration purposes +# this script will create these resources and delete them upon completion + +import oci +import sys + + +def create_vcn_and_subnets(virtual_network, compartment_id, first_ad, second_ad): + # Create a VCN + vcn_name = 'python_sdk_test_lb_vcn' + cidr_block = "10.0.0.0/16" + result = virtual_network.create_vcn( + oci.core.models.CreateVcnDetails( + cidr_block=cidr_block, + display_name=vcn_name, + compartment_id=compartment_id + ) + ) + + vcn = oci.wait_until( + virtual_network, + virtual_network.get_vcn(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + print('Created VCN') + + # Create a subnet + subnet_name = 'python_sdk_test_lb_subnet1' + subnet_cidr_block1 = "10.0.0.0/24" + result = virtual_network.create_subnet( + oci.core.models.CreateSubnetDetails( + compartment_id=compartment_id, + availability_domain=first_ad, + display_name=subnet_name, + vcn_id=vcn.id, + cidr_block=subnet_cidr_block1 + ) + ) + subnet_one = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + print('Created Subnet 1') + + # Create another subnet + subnet_name = 'python_sdk_test_lb_subnet2' + subnet_cidr_block2 = "10.0.1.0/24" + result = virtual_network.create_subnet( + oci.core.models.CreateSubnetDetails( + compartment_id=compartment_id, + availability_domain=second_ad, + display_name=subnet_name, + vcn_id=vcn.id, + cidr_block=subnet_cidr_block2 + ) + ) + subnet_two = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + print('Created Subnet 2') + + return {'vcn': vcn, 'subnets': [subnet_one, subnet_two]} + + +def delete_vcn_and_subnets(virtual_network, vcn_and_subnets): + vcn = vcn_and_subnets['vcn'] + subnet_one = vcn_and_subnets['subnets'][0] + subnet_two = vcn_and_subnets['subnets'][1] + + virtual_network.delete_subnet(subnet_one.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet_one.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=300, + # 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 + ) + + virtual_network.delete_subnet(subnet_two.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet_two.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=300, + succeed_on_not_found=True + ) + + virtual_network.delete_vcn(vcn.id) + oci.wait_until( + virtual_network, + virtual_network.get_vcn(vcn.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=300, + succeed_on_not_found=True + ) + + +# Default config file and profile +config = oci.config.from_file() +load_balancer_client = oci.load_balancer.LoadBalancerClient(config) +virtual_network_client = oci.core.VirtualNetworkClient(config) + +if len(sys.argv) != 4: + raise RuntimeError('This script needs to be provided a compartment ID and two availability domains') + +compartment_id = sys.argv[1] +first_ad = sys.argv[2] +second_ad = sys.argv[3] + +vcn_and_subnets = create_vcn_and_subnets(virtual_network_client, compartment_id, first_ad, second_ad) +subnets = vcn_and_subnets['subnets'] + +# As part of creating a load balancer, we can create path route sets. Note that this is a dictionary where each +# key is the path route set name and the value is the information on what routes are in the set. +# +# Additionally, when creating a listener as part of load balancer creation we can specify the path route +# set for that listener. This path route set needs to correspond to one of the ones we'll create as part of +# load balancer creation. +response = load_balancer_client.create_load_balancer( + oci.load_balancer.models.CreateLoadBalancerDetails( + compartment_id=compartment_id, + display_name='PathRouteSetLB', + shape_name='100Mbps', + subnet_ids=[subnets[0].id, subnets[1].id], + backend_sets={ + 'backend-1': oci.load_balancer.models.BackendSetDetails( + policy='ROUND_ROBIN', + health_checker=oci.load_balancer.models.HealthCheckerDetails( + protocol='HTTP', + url_path='/', + port=80, + retries=1, + timeout_in_millis=100, + interval_in_millis=1000 + ), + session_persistence_configuration=oci.load_balancer.models.SessionPersistenceConfigurationDetails( + cookie_name='*', + disable_fallback=False + ) + ), + 'backend-2': oci.load_balancer.models.BackendSetDetails( + policy='ROUND_ROBIN', + health_checker=oci.load_balancer.models.HealthCheckerDetails( + protocol='HTTP', + url_path='/testurl2', + port=80, + retries=1, + timeout_in_millis=100, + interval_in_millis=1000 + ) + ) + }, + path_route_sets={ + 'path-route-set-1': oci.load_balancer.models.PathRouteSetDetails( + path_routes=[ + oci.load_balancer.models.PathRoute( + # Note that this name matches one of the backend sets specified in the backend_sets dict + backend_set_name='backend-1', + path='/example/1', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='PREFIX_MATCH') + ), + oci.load_balancer.models.PathRoute( + backend_set_name='backend-1', + path='/other/path/2', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='EXACT_MATCH') + ) + ] + ) + }, + listeners={ + 'listener1': oci.load_balancer.models.ListenerDetails( + default_backend_set_name='backend-1', + # This path route set name corresponds to a name/key in the path_route_sets dict + path_route_set_name='path-route-set-1', + port=80, + protocol='HTTP' + ) + } + ) +) + +# CreateLoadBalancer gives us a work request we can check. This work request will be SUCCEEDED once the load +# balancer has been created +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) +response = load_balancer_client.get_work_request(work_request_id) +load_balancer_ocid = response.data.load_balancer_id +print('Load balancer created') +print('\n================================\n') + +# We can list the path route sets on the load balancer +path_route_sets = load_balancer_client.list_path_route_sets(load_balancer_ocid) +print('Path route sets from list:\n{}'.format(path_route_sets.data)) +print('\n================================\n') + +# We can also get an individual path route set +path_route_set = load_balancer_client.get_path_route_set(load_balancer_ocid, 'path-route-set-1').data +print('Path route set from GET:\n{}'.format(path_route_set)) +print('\n================================\n') + +# And it's accessible via the load balancer itself +load_balancer = load_balancer_client.get_load_balancer(load_balancer_ocid).data +print('Load balancer details:\n{}'.format(load_balancer)) +print('\n================================\n') + +# We can create another path route set on the load balancer. Note that this also returns a work request which +# we be SUCCEEDED once the path route set has been created +response = load_balancer_client.create_path_route_set( + oci.load_balancer.models.CreatePathRouteSetDetails( + # This name needs to be unique amongst the path route sets on the load balancer + name='path-route-set-2', + path_routes=[ + oci.load_balancer.models.PathRoute( + # Note that this needs to correspond to a backend set on the load balancer + backend_set_name='backend-2', + path='/example3/4', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='EXACT_MATCH') + ), + oci.load_balancer.models.PathRoute( + backend_set_name='backend-2', + path='/some/kind/of/path', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='EXACT_MATCH') + ) + ] + ), + load_balancer_ocid +) +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) + +path_route_sets = load_balancer_client.list_path_route_sets(load_balancer_ocid) +print('Path route sets from list after creating another set:\n{}'.format(path_route_sets.data)) +print('\n================================\n') + +# We can update the routes on a path route set. Note that this is a total replacement, so any routes which you want +# to preserve need to be passed as part of the update. +# +# In this example, we keep one of the path routes we defined above (the one for path /example3/4). The route for +# /some/kind/of/path will be removed as part of this update. +# +# Note that updating a path route also results in a work request that we can wait on until it succeeds +response = load_balancer_client.update_path_route_set( + oci.load_balancer.models.UpdatePathRouteSetDetails( + path_routes=[ + oci.load_balancer.models.PathRoute( + backend_set_name='backend-2', + path='/example3/4', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='EXACT_MATCH') + ), + oci.load_balancer.models.PathRoute( + backend_set_name='backend-2', + path='/a/different/path', + path_match_type=oci.load_balancer.models.PathMatchType(match_type='EXACT_MATCH') + ) + ] + ), + load_balancer_ocid, + 'path-route-set-2' +) +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) + +path_route_set = load_balancer_client.get_path_route_set(load_balancer_ocid, 'path-route-set-2').data +print('Path route set after update:\n{}'.format(path_route_set)) +print('\n================================\n') + +# We can update the path route set on an existing listener +response = load_balancer_client.update_listener( + oci.load_balancer.models.UpdateListenerDetails( + default_backend_set_name='backend-2', + path_route_set_name='path-route-set-2', + port=80, + protocol='HTTP' + ), + load_balancer_ocid, + 'listener1' +) +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) + +load_balancer = load_balancer_client.get_load_balancer(load_balancer_ocid).data +print('Listener after update:\n{}'.format(load_balancer.listeners)) +print('\n================================\n') + +# We can also create a listener with a path route set + +response = load_balancer_client.create_listener( + oci.load_balancer.models.CreateListenerDetails( + name='listener2', + default_backend_set_name='backend-1', + port=8080, + protocol='HTTP', + path_route_set_name='path-route-set-1' + ), + load_balancer_ocid +) +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) + +load_balancer = load_balancer_client.get_load_balancer(load_balancer_ocid).data +print('Listener after create new listener:\n{}'.format(load_balancer.listeners)) +print('\n================================\n') + +# We now delete the load balancer +response = load_balancer_client.delete_load_balancer(load_balancer_ocid) +work_request_id = response.headers['opc-work-request-id'] +oci.wait_until(load_balancer_client, load_balancer_client.get_work_request(work_request_id), 'lifecycle_state', 'SUCCEEDED', max_wait_seconds=300) +print('Deleted Load Balancer') + +delete_vcn_and_subnets(virtual_network_client, vcn_and_subnets) +print('Deleted VCN and subnets') +print('Script finished') diff --git a/examples/reserved_public_ip_example.py b/examples/reserved_public_ip_example.py new file mode 100644 index 0000000000..0e01683b11 --- /dev/null +++ b/examples/reserved_public_ip_example.py @@ -0,0 +1,273 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This script provides a basic example on how to work with reserved and ephemeral public IPs in the Python SDK by: +# +# - Creating a reserved public IP, assigning it to a private IP and unassigning it from a private IP +# - Creating an ephemeral private IP +# +# This script accepts three arguments: +# - The first argument is the compartment where we'll create the public IPs and required resources for this script +# - The second argument is the availability domain where we'll create a subnet and instance +# - The third argument is the image ID which we'll use to launch the instance +# +# The following supporting resources will be created by this script: +# - A VCN and subnet +# - An instance (so we can assign public IPs to VNICs on the instance) +# These supporting resources will be deleted at the end of the script + +import oci +import sys + + +def create_vcn_and_subnet(virtual_network, compartment_id, availability_domain): + # Create a VCN + vcn_name = 'python_sdk_test_vcn' + cidr_block = "10.0.0.0/16" + result = virtual_network.create_vcn( + oci.core.models.CreateVcnDetails( + cidr_block=cidr_block, + display_name=vcn_name, + compartment_id=compartment_id + ) + ) + + vcn = oci.wait_until( + virtual_network, + virtual_network.get_vcn(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + print('Created VCN') + + # Create a subnet + subnet_name = 'python_sdk_test_subnet1' + subnet_cidr_block1 = "10.0.0.0/24" + 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=subnet_cidr_block1 + ) + ) + subnet = oci.wait_until( + virtual_network, + virtual_network.get_subnet(result.data.id), + 'lifecycle_state', + 'AVAILABLE', + max_wait_seconds=300 + ).data + print('Created subnet') + + 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'] + + virtual_network.delete_subnet(subnet.id) + oci.wait_until( + virtual_network, + virtual_network.get_subnet(subnet.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=300, + # 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 + ) + + virtual_network.delete_vcn(vcn.id) + oci.wait_until( + virtual_network, + virtual_network.get_vcn(vcn.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=300, + succeed_on_not_found=True + ) + + +def launch_instance(compute, compartment_id, subnet, image_id): + create_instance_details = oci.core.models.LaunchInstanceDetails() + create_instance_details.compartment_id = compartment_id + create_instance_details.availability_domain = subnet.availability_domain + create_instance_details.display_name = 'pub_ip_test_instance' + create_instance_details.create_vnic_details = oci.core.models.CreateVnicDetails( + subnet_id=subnet.id, + # We don't assign a public IP here so that we can demonstrate public IP functionality later on + # in the script + assign_public_ip=False + ) + create_instance_details.image_id = image_id + create_instance_details.shape = 'VM.Standard1.1' + + result = compute.launch_instance(create_instance_details) + instance_ocid = result.data.id + + get_instance_response = oci.wait_until( + compute, + compute.get_instance(instance_ocid), + 'lifecycle_state', + 'RUNNING', + max_wait_seconds=600 + ) + print('Launched instance') + + return get_instance_response.data + + +def terminate_instance(compute, instance): + compute.terminate_instance(instance.id) + oci.wait_until( + compute, + compute.get_instance(instance.id), + 'lifecycle_state', + 'TERMINATED', + max_wait_seconds=600, + succeed_on_not_found=True + ) + + +if len(sys.argv) != 4: + raise RuntimeError('This script needs to be provided a compartment ID, an availability domain and an image OCID') + +compartment_id = sys.argv[1] +availability_domain = sys.argv[2] +image_id = sys.argv[3] + +# Default config file and profile +config = oci.config.from_file() +virtual_network = oci.core.VirtualNetworkClient(config) +compute = oci.core.ComputeClient(config) + +vcn_and_subnet = create_vcn_and_subnet(virtual_network, compartment_id, availability_domain) +instance = launch_instance(compute, compartment_id, vcn_and_subnet['subnet'], image_id) + +# First we'll create a reserved public IP. This does not have to be assigned to a private IP at create time, although +# it can be by specifying a private_ip_id in CreatePublicIpDetails. +create_public_ip_response = virtual_network.create_public_ip( + oci.core.models.CreatePublicIpDetails( + compartment_id=compartment_id, + display_name='py_sdk_example_res_ip', + lifetime='RESERVED' + ) +) +print('Created Public IP: {}'.format(create_public_ip_response.data)) +print('\n================================\n') + +# A Public IP has a lifecycle state, so we can wait until it is available or assigned to a private IP. If we +# need to wait on multiple states, we can use the evaluate_response parameter on the waiter. +get_public_ip_response = oci.wait_until( + virtual_network, + virtual_network.get_public_ip(create_public_ip_response.data.id), + evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'ASSIGNED'] +) +public_ip = get_public_ip_response.data +print('Public IP after waiting: {}'.format(public_ip)) +print('\n================================\n') + +# We can list public IPs. When doing this, we need to provide a scope - for reserved public IPs the scope is +# REGION. Since listing public IPs is a paginated operation, we can use the functionality in oci.pagination +# to get all results +all_region_scoped_public_ips = oci.pagination.list_call_get_all_results( + virtual_network.list_public_ips, + 'REGION', + compartment_id +) +print('All reserved public IPs: {}'.format(all_region_scoped_public_ips.data)) +print('\n================================\n') + +# We'll now assign the public IP to the private IP from the instance we launched earlier. First we'll need to +# get the ID of the private IP +vnic_attachments = compute.list_vnic_attachments(compartment_id, instance_id=instance.id).data +vnic_id = vnic_attachments[0].vnic_id +private_ip_id = virtual_network.list_private_ips(vnic_id=vnic_id).data[0].id + +# Now we can update the public IP to link it to the private IP. Once the update has been requested, we can +# use a waiter to wait until the public IP enters the appropriate state +virtual_network.update_public_ip( + public_ip.id, + oci.core.models.UpdatePublicIpDetails( + private_ip_id=private_ip_id + ) +) +updated_public_ip = oci.wait_until( + virtual_network, + virtual_network.get_public_ip(public_ip.id), + evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'ASSIGNED'] +) +print('Updated public IP: {}'.format(updated_public_ip.data)) +print('\n================================\n') + +# We can also unassign the public IP from any private IP by passing an empty string as the private_ip_id +# when doing the update. Note that the states we wait on after the update has been requested +virtual_network.update_public_ip( + public_ip.id, + oci.core.models.UpdatePublicIpDetails( + private_ip_id='' + ) +) +updated_public_ip = oci.wait_until( + virtual_network, + virtual_network.get_public_ip(public_ip.id), + evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'UNASSIGNED'] +) + +# If we are done with the public IP, we can delete it +virtual_network.delete_public_ip(public_ip.id) +print('Deleted reserved public IP') + +# We can also create an ephemeral public IP. For this type of public IP we need to assign it to a private IP +# at creation time +create_public_ip_response = virtual_network.create_public_ip( + oci.core.models.CreatePublicIpDetails( + compartment_id=compartment_id, + display_name='py_sdk_example_eph_ip', + lifetime='EPHEMERAL', + private_ip_id=private_ip_id + ) +) +print('Created Public IP: {}'.format(create_public_ip_response.data)) +print('\n================================\n') + +get_public_ip_response = oci.wait_until( + virtual_network, + virtual_network.get_public_ip(create_public_ip_response.data.id), + evaluate_response=lambda r: r.data.lifecycle_state in ['AVAILABLE', 'ASSIGNED'] +) +public_ip = get_public_ip_response.data +print('Public IP after waiting: {}'.format(public_ip)) +print('\n================================\n') + +# We can list public IPs. When doing this, we need to provide a scope - for ephemeral public IPs the scope is +# AVAILABILITY_DOMAIN. We can also provide the availability domain we want to retrieve public IPs for. +# Since listing public IPs is a paginated operation, we can use the functionality in oci.pagination +# to get all results +all_ad_scoped_public_ips = oci.pagination.list_call_get_all_results( + virtual_network.list_public_ips, + 'AVAILABILITY_DOMAIN', + compartment_id, + availability_domain=availability_domain +) +print('All ephemeral public IPs in {}: {}'.format(availability_domain, all_ad_scoped_public_ips.data)) +print('\n================================\n') + +# We can delete an ephemeral public IP, but it will also disappear when we terminate the instance +terminate_instance(compute, instance) +oci.wait_until( + virtual_network, + get_public_ip_response, + 'lifecycle_state', + 'TERMINATED', + succeed_on_not_found=True +) +print('Terminated instance - ephemeral public IP also deleted') + +delete_vcn_and_subnet(virtual_network, vcn_and_subnet) +print('Script finished') diff --git a/examples/volume_backup_policy_example.py b/examples/volume_backup_policy_example.py new file mode 100644 index 0000000000..88ed1c5728 --- /dev/null +++ b/examples/volume_backup_policy_example.py @@ -0,0 +1,59 @@ +# coding: utf-8 +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + +# This example demonstrates how to list and apply backup policies to an existing volume. Note that in order to list and apply backup policies you will need +# the appropriate level of access. See the section "Required IAM Policy" on this page: +# https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/schedulingvolumebackups.htm for more information +# +# This example takes a single argument, which is the OCID of the volume which we'll apply the policy to +# +# You can also specify a backup policy at volume create time by providing a backup_policy_id. For example: +# +# result = block_storage.create_volume( +# oci.core.models.CreateVolumeDetails( +# display_name='my_volume_with_a_policy', +# size_in_gbs=50, +# availability_domain=availability_domain, +# compartment_id=compartment_id, +# backup_policy_id=volume_backup_policy.id +# ) +# ) + +import oci +import sys + + +config = oci.config.from_file() +block_storage_client = oci.core.BlockstorageClient(config) + +if len(sys.argv) != 2: + raise RuntimeError('This script expects an argument the OCID of the volume which the policy will be applied to') +volume_id = sys.argv[1] + +# Backup policies are a paginated call, so we can use the functions in the oci.pagination module to get all available policies +volume_backup_policies = oci.pagination.list_call_get_all_results(block_storage_client.list_volume_backup_policies) +print('Policies:\n{}'.format(volume_backup_policies.data)) + +# We can retrieve a specific policy +volume_backup_policy = block_storage_client.get_volume_backup_policy(volume_backup_policies.data[0].id).data +print('Selected policy:\n{}'.format(volume_backup_policy)) + +# We can assign a policy to a volume +create_response = block_storage_client.create_volume_backup_policy_assignment( + oci.core.models.CreateVolumeBackupPolicyAssignmentDetails( + asset_id=volume_id, + policy_id=volume_backup_policy.id + ) +) +print('Assigned policy to volume:\n{}'.format(create_response.data)) + +# We can interrogate whether an asset (a volume in this case) has a policy applied +get_policy_asset_assignment = block_storage_client.get_volume_backup_policy_asset_assignment(volume_id) +print('Assigned policy:\n{}'.format(get_policy_asset_assignment.data)) + +# We can remove a policy from an asset using the ID of the record which represents the assignment of the policy to the asset +block_storage_client.delete_volume_backup_policy_assignment(get_policy_asset_assignment.data[0].id) + +# And now the asset reports it has no policies on it +get_policy_asset_assignment = block_storage_client.get_volume_backup_policy_asset_assignment(volume_id) +print('Assigned policy:\n{}'.format(get_policy_asset_assignment.data)) diff --git a/src/oci/__init__.py b/src/oci/__init__.py index 125eae786e..b2f2af3852 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, identity, load_balancer, object_storage +from . import audit, core, database, dns, 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", "identity", "load_balancer", "object_storage" + "audit", "core", "database", "dns", "identity", "load_balancer", "object_storage" ] diff --git a/src/oci/base_client.py b/src/oci/base_client.py index cb76258424..8f8ec82513 100644 --- a/src/oci/base_client.py +++ b/src/oci/base_client.py @@ -64,7 +64,7 @@ class BaseClient(object): "object": object } - def __init__(self, service, config, signer, type_mapping): + def __init__(self, service, config, signer, type_mapping, **kwargs): validate_config(config, signer=signer) self.signer = signer @@ -82,6 +82,7 @@ def __init__(self, service, config, signer, type_mapping): self.complex_type_mappings = type_mapping self.type_mappings = merge_type_mappings(self.primitive_type_map, type_mapping) self.session = requests.Session() + self.timeout = kwargs.get('timeout') self.user_agent = build_user_agent(get_config_value_or_default(config, "additional_user_agent")) self.logger = logging.getLogger("{}.{}".format(__name__, id(self))) @@ -233,7 +234,8 @@ def request(self, request): params=request.query_params, headers=request.header_params, data=request.body, - stream=stream) + stream=stream, + timeout=self.timeout) response_type = request.response_type self.logger.debug("Response status: %s" % str(response.status_code)) diff --git a/src/oci/core/blockstorage_client.py b/src/oci/core/blockstorage_client.py index ef45263abd..bf5ec9ba2b 100644 --- a/src/oci/core/blockstorage_client.py +++ b/src/oci/core/blockstorage_client.py @@ -170,6 +170,50 @@ def create_volume_backup(self, create_volume_backup_details, **kwargs): body=create_volume_backup_details, response_type="VolumeBackup") + def create_volume_backup_policy_assignment(self, create_volume_backup_policy_assignment_details, **kwargs): + """ + CreateVolumeBackupPolicyAssignment + Assigns a policy to the specified asset, such as a volume. Note that a given asset can + only have one policy assigned to it; if this method is called for an asset that previously + has a different policy assigned, the prior assignment will be silently deleted. + + + :param CreateVolumeBackupPolicyAssignmentDetails create_volume_backup_policy_assignment_details: (required) + Request to assign a specified policy to a particular asset. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.VolumeBackupPolicyAssignment` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/volumeBackupPolicyAssignments" + method = "POST" + + expected_kwargs = ["retry_strategy"] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_volume_backup_policy_assignment got unknown kwargs: {!r}".format(extra_kwargs)) + + 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, + header_params=header_params, + body=create_volume_backup_policy_assignment_details, + response_type="VolumeBackupPolicyAssignment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_volume_backup_policy_assignment_details, + response_type="VolumeBackupPolicyAssignment") + def delete_boot_volume(self, boot_volume_id, **kwargs): """ DeleteBootVolume @@ -363,6 +407,67 @@ def delete_volume_backup(self, volume_backup_id, **kwargs): path_params=path_params, header_params=header_params) + def delete_volume_backup_policy_assignment(self, policy_assignment_id, **kwargs): + """ + DeleteVolumeBackupPolicyAssignment + Deletes a volume backup policy assignment (i.e. unassigns the policy from an asset). + + + :param str policy_assignment_id: (required) + The OCID of the volume backup policy assignment. + + :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 = "/volumeBackupPolicyAssignments/{policyAssignmentId}" + 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_volume_backup_policy_assignment got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "policyAssignmentId": policy_assignment_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_boot_volume(self, boot_volume_id, **kwargs): """ GetBootVolume @@ -519,6 +624,174 @@ def get_volume_backup(self, volume_backup_id, **kwargs): header_params=header_params, response_type="VolumeBackup") + def get_volume_backup_policy(self, policy_id, **kwargs): + """ + GetVolumeBackupPolicy + Gets information for the specified volume backup policy. + + + :param str policy_id: (required) + The OCID of the volume backup policy. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.VolumeBackupPolicy` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/volumeBackupPolicies/{policyId}" + 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_volume_backup_policy got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "policyId": policy_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="VolumeBackupPolicy") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeBackupPolicy") + + def get_volume_backup_policy_asset_assignment(self, asset_id, **kwargs): + """ + GetVolumeBackupPolicyAssetAssignment + Gets the volume backup policy assignment for the specified asset. Note that the + assetId query parameter is required, and that the returned list will contain at most + one item (since any given asset can only have one policy assigned to it). + + + :param str asset_id: (required) + The OCID of an asset (e.g. a volume). + + :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. + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.core.models.VolumeBackupPolicyAssignment` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/volumeBackupPolicyAssignments" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_volume_backup_policy_asset_assignment got unknown kwargs: {!r}".format(extra_kwargs)) + + query_params = { + "assetId": asset_id, + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", 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[VolumeBackupPolicyAssignment]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeBackupPolicyAssignment]") + + def get_volume_backup_policy_assignment(self, policy_assignment_id, **kwargs): + """ + GetVolumeBackupPolicyAssignment + Gets information for the specified volume backup policy assignment. + + + :param str policy_assignment_id: (required) + The OCID of the volume backup policy assignment. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.VolumeBackupPolicyAssignment` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/volumeBackupPolicyAssignments/{policyAssignmentId}" + 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_volume_backup_policy_assignment got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "policyAssignmentId": policy_assignment_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="VolumeBackupPolicyAssignment") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="VolumeBackupPolicyAssignment") + def list_boot_volumes(self, availability_domain, compartment_id, **kwargs): """ ListBootVolumes @@ -587,6 +860,64 @@ def list_boot_volumes(self, availability_domain, compartment_id, **kwargs): header_params=header_params, response_type="list[BootVolume]") + def list_volume_backup_policies(self, **kwargs): + """ + ListVolumeBackupPolicies + Lists all volume backup policies available to the caller. + + + :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. + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.core.models.VolumeBackupPolicy` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/volumeBackupPolicies" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_volume_backup_policies got unknown kwargs: {!r}".format(extra_kwargs)) + + query_params = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", 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[VolumeBackupPolicy]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[VolumeBackupPolicy]") + def list_volume_backups(self, compartment_id, **kwargs): """ ListVolumeBackups diff --git a/src/oci/core/compute_client.py b/src/oci/core/compute_client.py index 69f1d22647..94ac8dd77b 100644 --- a/src/oci/core/compute_client.py +++ b/src/oci/core/compute_client.py @@ -326,7 +326,7 @@ def create_image(self, create_image_details, **kwargs): :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.Image` :rtype: :class:`~oci.response.Response` """ - resource_path = "/images/" + resource_path = "/images" method = "POST" # Don't accept unknown kwargs @@ -1819,6 +1819,9 @@ def list_images(self, compartment_id, **kwargs): Example: `7.2` + :param str shape: (optional) + Shape name. + :param int limit: (optional) The maximum number of items to return in a paginated \"List\" call. @@ -1853,7 +1856,7 @@ def list_images(self, compartment_id, **kwargs): :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.core.models.Image` :rtype: :class:`~oci.response.Response` """ - resource_path = "/images/" + resource_path = "/images" method = "GET" # Don't accept unknown kwargs @@ -1862,6 +1865,7 @@ def list_images(self, compartment_id, **kwargs): "display_name", "operating_system", "operating_system_version", + "shape", "limit", "page", "sort_by", @@ -1899,6 +1903,7 @@ def list_images(self, compartment_id, **kwargs): "displayName": kwargs.get("display_name", missing), "operatingSystem": kwargs.get("operating_system", missing), "operatingSystemVersion": kwargs.get("operating_system_version", missing), + "shape": kwargs.get("shape", missing), "limit": kwargs.get("limit", missing), "page": kwargs.get("page", missing), "sortBy": kwargs.get("sort_by", missing), diff --git a/src/oci/core/models/__init__.py b/src/oci/core/models/__init__.py index 2f51de9f2b..0e491474b3 100644 --- a/src/oci/core/models/__init__.py +++ b/src/oci/core/models/__init__.py @@ -27,6 +27,7 @@ from .create_internet_gateway_details import CreateInternetGatewayDetails from .create_local_peering_gateway_details import CreateLocalPeeringGatewayDetails from .create_private_ip_details import CreatePrivateIpDetails +from .create_public_ip_details import CreatePublicIpDetails from .create_route_table_details import CreateRouteTableDetails from .create_security_list_details import CreateSecurityListDetails from .create_subnet_details import CreateSubnetDetails @@ -35,6 +36,7 @@ from .create_virtual_circuit_public_prefix_details import CreateVirtualCircuitPublicPrefixDetails from .create_vnic_details import CreateVnicDetails from .create_volume_backup_details import CreateVolumeBackupDetails +from .create_volume_backup_policy_assignment_details import CreateVolumeBackupPolicyAssignmentDetails from .create_volume_details import CreateVolumeDetails from .cross_connect import CrossConnect from .cross_connect_group import CrossConnectGroup @@ -54,6 +56,8 @@ from .export_image_via_object_storage_tuple_details import ExportImageViaObjectStorageTupleDetails from .export_image_via_object_storage_uri_details import ExportImageViaObjectStorageUriDetails from .fast_connect_provider_service import FastConnectProviderService +from .get_public_ip_by_ip_address_details import GetPublicIpByIpAddressDetails +from .get_public_ip_by_private_ip_id_details import GetPublicIpByPrivateIpIdDetails from .ip_sec_connection import IPSecConnection from .ip_sec_connection_device_config import IPSecConnectionDeviceConfig from .ip_sec_connection_device_status import IPSecConnectionDeviceStatus @@ -77,6 +81,7 @@ from .local_peering_gateway import LocalPeeringGateway from .port_range import PortRange from .private_ip import PrivateIp +from .public_ip import PublicIp from .route_rule import RouteRule from .route_table import RouteTable from .security_list import SecurityList @@ -100,6 +105,7 @@ from .update_internet_gateway_details import UpdateInternetGatewayDetails from .update_local_peering_gateway_details import UpdateLocalPeeringGatewayDetails from .update_private_ip_details import UpdatePrivateIpDetails +from .update_public_ip_details import UpdatePublicIpDetails from .update_route_table_details import UpdateRouteTableDetails from .update_security_list_details import UpdateSecurityListDetails from .update_subnet_details import UpdateSubnetDetails @@ -117,6 +123,9 @@ from .volume import Volume from .volume_attachment import VolumeAttachment from .volume_backup import VolumeBackup +from .volume_backup_policy import VolumeBackupPolicy +from .volume_backup_policy_assignment import VolumeBackupPolicyAssignment +from .volume_backup_schedule import VolumeBackupSchedule from .volume_source_details import VolumeSourceDetails from .volume_source_from_volume_backup_details import VolumeSourceFromVolumeBackupDetails from .volume_source_from_volume_details import VolumeSourceFromVolumeDetails @@ -147,6 +156,7 @@ "CreateInternetGatewayDetails": CreateInternetGatewayDetails, "CreateLocalPeeringGatewayDetails": CreateLocalPeeringGatewayDetails, "CreatePrivateIpDetails": CreatePrivateIpDetails, + "CreatePublicIpDetails": CreatePublicIpDetails, "CreateRouteTableDetails": CreateRouteTableDetails, "CreateSecurityListDetails": CreateSecurityListDetails, "CreateSubnetDetails": CreateSubnetDetails, @@ -155,6 +165,7 @@ "CreateVirtualCircuitPublicPrefixDetails": CreateVirtualCircuitPublicPrefixDetails, "CreateVnicDetails": CreateVnicDetails, "CreateVolumeBackupDetails": CreateVolumeBackupDetails, + "CreateVolumeBackupPolicyAssignmentDetails": CreateVolumeBackupPolicyAssignmentDetails, "CreateVolumeDetails": CreateVolumeDetails, "CrossConnect": CrossConnect, "CrossConnectGroup": CrossConnectGroup, @@ -174,6 +185,8 @@ "ExportImageViaObjectStorageTupleDetails": ExportImageViaObjectStorageTupleDetails, "ExportImageViaObjectStorageUriDetails": ExportImageViaObjectStorageUriDetails, "FastConnectProviderService": FastConnectProviderService, + "GetPublicIpByIpAddressDetails": GetPublicIpByIpAddressDetails, + "GetPublicIpByPrivateIpIdDetails": GetPublicIpByPrivateIpIdDetails, "IPSecConnection": IPSecConnection, "IPSecConnectionDeviceConfig": IPSecConnectionDeviceConfig, "IPSecConnectionDeviceStatus": IPSecConnectionDeviceStatus, @@ -197,6 +210,7 @@ "LocalPeeringGateway": LocalPeeringGateway, "PortRange": PortRange, "PrivateIp": PrivateIp, + "PublicIp": PublicIp, "RouteRule": RouteRule, "RouteTable": RouteTable, "SecurityList": SecurityList, @@ -220,6 +234,7 @@ "UpdateInternetGatewayDetails": UpdateInternetGatewayDetails, "UpdateLocalPeeringGatewayDetails": UpdateLocalPeeringGatewayDetails, "UpdatePrivateIpDetails": UpdatePrivateIpDetails, + "UpdatePublicIpDetails": UpdatePublicIpDetails, "UpdateRouteTableDetails": UpdateRouteTableDetails, "UpdateSecurityListDetails": UpdateSecurityListDetails, "UpdateSubnetDetails": UpdateSubnetDetails, @@ -237,6 +252,9 @@ "Volume": Volume, "VolumeAttachment": VolumeAttachment, "VolumeBackup": VolumeBackup, + "VolumeBackupPolicy": VolumeBackupPolicy, + "VolumeBackupPolicyAssignment": VolumeBackupPolicyAssignment, + "VolumeBackupSchedule": VolumeBackupSchedule, "VolumeSourceDetails": VolumeSourceDetails, "VolumeSourceFromVolumeBackupDetails": VolumeSourceFromVolumeBackupDetails, "VolumeSourceFromVolumeDetails": VolumeSourceFromVolumeDetails diff --git a/src/oci/core/models/attach_i_scsi_volume_details.py b/src/oci/core/models/attach_i_scsi_volume_details.py index c6ed735183..57fd3c294d 100644 --- a/src/oci/core/models/attach_i_scsi_volume_details.py +++ b/src/oci/core/models/attach_i_scsi_volume_details.py @@ -23,6 +23,10 @@ def __init__(self, **kwargs): The value to assign to the instance_id property of this AttachIScsiVolumeDetails. :type instance_id: str + :param is_read_only: + The value to assign to the is_read_only property of this AttachIScsiVolumeDetails. + :type is_read_only: bool + :param type: The value to assign to the type property of this AttachIScsiVolumeDetails. :type type: str @@ -39,6 +43,7 @@ def __init__(self, **kwargs): self.swagger_types = { 'display_name': 'str', 'instance_id': 'str', + 'is_read_only': 'bool', 'type': 'str', 'volume_id': 'str', 'use_chap': 'bool' @@ -47,6 +52,7 @@ def __init__(self, **kwargs): self.attribute_map = { 'display_name': 'displayName', 'instance_id': 'instanceId', + 'is_read_only': 'isReadOnly', 'type': 'type', 'volume_id': 'volumeId', 'use_chap': 'useChap' @@ -54,6 +60,7 @@ def __init__(self, **kwargs): self._display_name = None self._instance_id = None + self._is_read_only = None self._type = None self._volume_id = None self._use_chap = None diff --git a/src/oci/core/models/attach_volume_details.py b/src/oci/core/models/attach_volume_details.py index 2054e5d10a..a0836c57bf 100644 --- a/src/oci/core/models/attach_volume_details.py +++ b/src/oci/core/models/attach_volume_details.py @@ -26,6 +26,10 @@ def __init__(self, **kwargs): The value to assign to the instance_id property of this AttachVolumeDetails. :type instance_id: str + :param is_read_only: + The value to assign to the is_read_only property of this AttachVolumeDetails. + :type is_read_only: bool + :param type: The value to assign to the type property of this AttachVolumeDetails. :type type: str @@ -38,6 +42,7 @@ def __init__(self, **kwargs): self.swagger_types = { 'display_name': 'str', 'instance_id': 'str', + 'is_read_only': 'bool', 'type': 'str', 'volume_id': 'str' } @@ -45,12 +50,14 @@ def __init__(self, **kwargs): self.attribute_map = { 'display_name': 'displayName', 'instance_id': 'instanceId', + 'is_read_only': 'isReadOnly', 'type': 'type', 'volume_id': 'volumeId' } self._display_name = None self._instance_id = None + self._is_read_only = None self._type = None self._volume_id = None @@ -115,6 +122,30 @@ def instance_id(self, instance_id): """ self._instance_id = instance_id + @property + def is_read_only(self): + """ + Gets the is_read_only of this AttachVolumeDetails. + Whether the attachment was created in read-only mode. + + + :return: The is_read_only of this AttachVolumeDetails. + :rtype: bool + """ + return self._is_read_only + + @is_read_only.setter + def is_read_only(self, is_read_only): + """ + Sets the is_read_only of this AttachVolumeDetails. + Whether the attachment was created in read-only mode. + + + :param is_read_only: The is_read_only of this AttachVolumeDetails. + :type: bool + """ + self._is_read_only = is_read_only + @property def type(self): """ diff --git a/src/oci/core/models/create_public_ip_details.py b/src/oci/core/models/create_public_ip_details.py new file mode 100644 index 0000000000..b0db6f2789 --- /dev/null +++ b/src/oci/core/models/create_public_ip_details.py @@ -0,0 +1,194 @@ +# 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 CreatePublicIpDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreatePublicIpDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param compartment_id: + The value to assign to the compartment_id property of this CreatePublicIpDetails. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this CreatePublicIpDetails. + :type display_name: str + + :param lifetime: + The value to assign to the lifetime property of this CreatePublicIpDetails. + Allowed values for this property are: "EPHEMERAL", "RESERVED" + :type lifetime: str + + :param private_ip_id: + The value to assign to the private_ip_id property of this CreatePublicIpDetails. + :type private_ip_id: str + + """ + self.swagger_types = { + 'compartment_id': 'str', + 'display_name': 'str', + 'lifetime': 'str', + 'private_ip_id': 'str' + } + + self.attribute_map = { + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'lifetime': 'lifetime', + 'private_ip_id': 'privateIpId' + } + + self._compartment_id = None + self._display_name = None + self._lifetime = None + self._private_ip_id = None + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this CreatePublicIpDetails. + The OCID of the compartment to contain the public IP. For ephemeral public IPs, + you must set this to the private IP's compartment OCID. + + + :return: The compartment_id of this CreatePublicIpDetails. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this CreatePublicIpDetails. + The OCID of the compartment to contain the public IP. For ephemeral public IPs, + you must set this to the private IP's compartment OCID. + + + :param compartment_id: The compartment_id of this CreatePublicIpDetails. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + Gets the display_name of this CreatePublicIpDetails. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :return: The display_name of this CreatePublicIpDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this CreatePublicIpDetails. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :param display_name: The display_name of this CreatePublicIpDetails. + :type: str + """ + self._display_name = display_name + + @property + def lifetime(self): + """ + **[Required]** Gets the lifetime of this CreatePublicIpDetails. + Defines when the public IP is deleted and released back to the Oracle Cloud + Infrastructure public IP pool. For more information, see + `Public IP Addresses`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + Allowed values for this property are: "EPHEMERAL", "RESERVED" + + + :return: The lifetime of this CreatePublicIpDetails. + :rtype: str + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """ + Sets the lifetime of this CreatePublicIpDetails. + Defines when the public IP is deleted and released back to the Oracle Cloud + Infrastructure public IP pool. For more information, see + `Public IP Addresses`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + + :param lifetime: The lifetime of this CreatePublicIpDetails. + :type: str + """ + allowed_values = ["EPHEMERAL", "RESERVED"] + if not value_allowed_none_or_none_sentinel(lifetime, allowed_values): + raise ValueError( + "Invalid value for `lifetime`, must be None or one of {0}" + .format(allowed_values) + ) + self._lifetime = lifetime + + @property + def private_ip_id(self): + """ + Gets the private_ip_id of this CreatePublicIpDetails. + The OCID of the private IP to assign the public IP to. + + Required for an ephemeral public IP because it must always be assigned to a private IP + (specifically a *primary* private IP). + + Optional for a reserved public IP. If you don't provide it, the public IP is created but not + assigned to a private IP. You can later assign the public IP with + :func:`update_public_ip`. + + + :return: The private_ip_id of this CreatePublicIpDetails. + :rtype: str + """ + return self._private_ip_id + + @private_ip_id.setter + def private_ip_id(self, private_ip_id): + """ + Sets the private_ip_id of this CreatePublicIpDetails. + The OCID of the private IP to assign the public IP to. + + Required for an ephemeral public IP because it must always be assigned to a private IP + (specifically a *primary* private IP). + + Optional for a reserved public IP. If you don't provide it, the public IP is created but not + assigned to a private IP. You can later assign the public IP with + :func:`update_public_ip`. + + + :param private_ip_id: The private_ip_id of this CreatePublicIpDetails. + :type: str + """ + self._private_ip_id = private_ip_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/core/models/create_vnic_details.py b/src/oci/core/models/create_vnic_details.py index cc23ca53e0..4303774b46 100644 --- a/src/oci/core/models/create_vnic_details.py +++ b/src/oci/core/models/create_vnic_details.py @@ -77,13 +77,20 @@ def assign_public_ip(self): `prohibitPublicIpOnVnic` = true, an error is returned. **Note:** This public IP address is associated with the primary private IP - on the VNIC. Secondary private IPs cannot have public IP - addresses associated with them. For more information, see + on the VNIC. For more information, see `IP Addresses`__. + **Note:** There's a limit to the number of :class:`PublicIp` + a VNIC or instance can have. If you try to create a secondary VNIC + with an assigned public IP for an instance that has already + reached its public IP limit, an error is returned. For information + about the public IP limits, see + `Public IP Addresses`__. + Example: `false` __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm :return: The assign_public_ip of this CreateVnicDetails. @@ -104,13 +111,20 @@ def assign_public_ip(self, assign_public_ip): `prohibitPublicIpOnVnic` = true, an error is returned. **Note:** This public IP address is associated with the primary private IP - on the VNIC. Secondary private IPs cannot have public IP - addresses associated with them. For more information, see + on the VNIC. For more information, see `IP Addresses`__. + **Note:** There's a limit to the number of :class:`PublicIp` + a VNIC or instance can have. If you try to create a secondary VNIC + with an assigned public IP for an instance that has already + reached its public IP limit, an error is returned. For information + about the public IP limits, see + `Public IP Addresses`__. + Example: `false` __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPaddresses.htm + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm :param assign_public_ip: The assign_public_ip of this CreateVnicDetails. diff --git a/src/oci/core/models/create_volume_backup_details.py b/src/oci/core/models/create_volume_backup_details.py index b3638edeab..7a33b4d79a 100644 --- a/src/oci/core/models/create_volume_backup_details.py +++ b/src/oci/core/models/create_volume_backup_details.py @@ -26,6 +26,11 @@ def __init__(self, **kwargs): The value to assign to the freeform_tags property of this CreateVolumeBackupDetails. :type freeform_tags: dict(str, str) + :param type: + The value to assign to the type property of this CreateVolumeBackupDetails. + Allowed values for this property are: "FULL", "INCREMENTAL" + :type type: str + :param volume_id: The value to assign to the volume_id property of this CreateVolumeBackupDetails. :type volume_id: str @@ -35,6 +40,7 @@ def __init__(self, **kwargs): 'defined_tags': 'dict(str, dict(str, object))', 'display_name': 'str', 'freeform_tags': 'dict(str, str)', + 'type': 'str', 'volume_id': 'str' } @@ -42,12 +48,14 @@ def __init__(self, **kwargs): 'defined_tags': 'definedTags', 'display_name': 'displayName', 'freeform_tags': 'freeformTags', + 'type': 'type', 'volume_id': 'volumeId' } self._defined_tags = None self._display_name = None self._freeform_tags = None + self._type = None self._volume_id = None @property @@ -146,6 +154,38 @@ def freeform_tags(self, freeform_tags): """ self._freeform_tags = freeform_tags + @property + def type(self): + """ + Gets the type of this CreateVolumeBackupDetails. + The type of backup to create. If omitted, defaults to INCREMENTAL. + + Allowed values for this property are: "FULL", "INCREMENTAL" + + + :return: The type of this CreateVolumeBackupDetails. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """ + Sets the type of this CreateVolumeBackupDetails. + The type of backup to create. If omitted, defaults to INCREMENTAL. + + + :param type: The type of this CreateVolumeBackupDetails. + :type: str + """ + allowed_values = ["FULL", "INCREMENTAL"] + if not value_allowed_none_or_none_sentinel(type, allowed_values): + raise ValueError( + "Invalid value for `type`, must be None or one of {0}" + .format(allowed_values) + ) + self._type = type + @property def volume_id(self): """ diff --git a/src/oci/core/models/create_volume_backup_policy_assignment_details.py b/src/oci/core/models/create_volume_backup_policy_assignment_details.py new file mode 100644 index 0000000000..24560caa1a --- /dev/null +++ b/src/oci/core/models/create_volume_backup_policy_assignment_details.py @@ -0,0 +1,97 @@ +# 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 CreateVolumeBackupPolicyAssignmentDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateVolumeBackupPolicyAssignmentDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param asset_id: + The value to assign to the asset_id property of this CreateVolumeBackupPolicyAssignmentDetails. + :type asset_id: str + + :param policy_id: + The value to assign to the policy_id property of this CreateVolumeBackupPolicyAssignmentDetails. + :type policy_id: str + + """ + self.swagger_types = { + 'asset_id': 'str', + 'policy_id': 'str' + } + + self.attribute_map = { + 'asset_id': 'assetId', + 'policy_id': 'policyId' + } + + self._asset_id = None + self._policy_id = None + + @property + def asset_id(self): + """ + **[Required]** Gets the asset_id of this CreateVolumeBackupPolicyAssignmentDetails. + The OCID of the asset (e.g. a volume) to which to assign the policy. + + + :return: The asset_id of this CreateVolumeBackupPolicyAssignmentDetails. + :rtype: str + """ + return self._asset_id + + @asset_id.setter + def asset_id(self, asset_id): + """ + Sets the asset_id of this CreateVolumeBackupPolicyAssignmentDetails. + The OCID of the asset (e.g. a volume) to which to assign the policy. + + + :param asset_id: The asset_id of this CreateVolumeBackupPolicyAssignmentDetails. + :type: str + """ + self._asset_id = asset_id + + @property + def policy_id(self): + """ + **[Required]** Gets the policy_id of this CreateVolumeBackupPolicyAssignmentDetails. + The OCID of the volume backup policy to assign to an asset. + + + :return: The policy_id of this CreateVolumeBackupPolicyAssignmentDetails. + :rtype: str + """ + return self._policy_id + + @policy_id.setter + def policy_id(self, policy_id): + """ + Sets the policy_id of this CreateVolumeBackupPolicyAssignmentDetails. + The OCID of the volume backup policy to assign to an asset. + + + :param policy_id: The policy_id of this CreateVolumeBackupPolicyAssignmentDetails. + :type: str + """ + self._policy_id = policy_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/core/models/create_volume_details.py b/src/oci/core/models/create_volume_details.py index 394e8a801b..6025d4eb0f 100644 --- a/src/oci/core/models/create_volume_details.py +++ b/src/oci/core/models/create_volume_details.py @@ -18,6 +18,10 @@ def __init__(self, **kwargs): The value to assign to the availability_domain property of this CreateVolumeDetails. :type availability_domain: str + :param backup_policy_id: + The value to assign to the backup_policy_id property of this CreateVolumeDetails. + :type backup_policy_id: str + :param compartment_id: The value to assign to the compartment_id property of this CreateVolumeDetails. :type compartment_id: str @@ -53,6 +57,7 @@ def __init__(self, **kwargs): """ self.swagger_types = { 'availability_domain': 'str', + 'backup_policy_id': 'str', 'compartment_id': 'str', 'defined_tags': 'dict(str, dict(str, object))', 'display_name': 'str', @@ -65,6 +70,7 @@ def __init__(self, **kwargs): self.attribute_map = { 'availability_domain': 'availabilityDomain', + 'backup_policy_id': 'backupPolicyId', 'compartment_id': 'compartmentId', 'defined_tags': 'definedTags', 'display_name': 'displayName', @@ -76,6 +82,7 @@ def __init__(self, **kwargs): } self._availability_domain = None + self._backup_policy_id = None self._compartment_id = None self._defined_tags = None self._display_name = None @@ -113,6 +120,32 @@ def availability_domain(self, availability_domain): """ self._availability_domain = availability_domain + @property + def backup_policy_id(self): + """ + Gets the backup_policy_id of this CreateVolumeDetails. + If provided, specifies the ID of the volume backup policy to assign to the newly + created volume. If omitted, no policy will be assigned. + + + :return: The backup_policy_id of this CreateVolumeDetails. + :rtype: str + """ + return self._backup_policy_id + + @backup_policy_id.setter + def backup_policy_id(self, backup_policy_id): + """ + Sets the backup_policy_id of this CreateVolumeDetails. + If provided, specifies the ID of the volume backup policy to assign to the newly + created volume. If omitted, no policy will be assigned. + + + :param backup_policy_id: The backup_policy_id of this CreateVolumeDetails. + :type: str + """ + self._backup_policy_id = backup_policy_id + @property def compartment_id(self): """ diff --git a/src/oci/core/models/get_public_ip_by_ip_address_details.py b/src/oci/core/models/get_public_ip_by_ip_address_details.py new file mode 100644 index 0000000000..4ffc1e426d --- /dev/null +++ b/src/oci/core/models/get_public_ip_by_ip_address_details.py @@ -0,0 +1,68 @@ +# 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 GetPublicIpByIpAddressDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new GetPublicIpByIpAddressDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param ip_address: + The value to assign to the ip_address property of this GetPublicIpByIpAddressDetails. + :type ip_address: str + + """ + self.swagger_types = { + 'ip_address': 'str' + } + + self.attribute_map = { + 'ip_address': 'ipAddress' + } + + self._ip_address = None + + @property + def ip_address(self): + """ + **[Required]** Gets the ip_address of this GetPublicIpByIpAddressDetails. + The public IP address. + Example: 129.146.2.1 + + + :return: The ip_address of this GetPublicIpByIpAddressDetails. + :rtype: str + """ + return self._ip_address + + @ip_address.setter + def ip_address(self, ip_address): + """ + Sets the ip_address of this GetPublicIpByIpAddressDetails. + The public IP address. + Example: 129.146.2.1 + + + :param ip_address: The ip_address of this GetPublicIpByIpAddressDetails. + :type: str + """ + self._ip_address = ip_address + + 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/core/models/get_public_ip_by_private_ip_id_details.py b/src/oci/core/models/get_public_ip_by_private_ip_id_details.py new file mode 100644 index 0000000000..0c138fe8dd --- /dev/null +++ b/src/oci/core/models/get_public_ip_by_private_ip_id_details.py @@ -0,0 +1,66 @@ +# 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 GetPublicIpByPrivateIpIdDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new GetPublicIpByPrivateIpIdDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param private_ip_id: + The value to assign to the private_ip_id property of this GetPublicIpByPrivateIpIdDetails. + :type private_ip_id: str + + """ + self.swagger_types = { + 'private_ip_id': 'str' + } + + self.attribute_map = { + 'private_ip_id': 'privateIpId' + } + + self._private_ip_id = None + + @property + def private_ip_id(self): + """ + **[Required]** Gets the private_ip_id of this GetPublicIpByPrivateIpIdDetails. + OCID of the private IP. + + + :return: The private_ip_id of this GetPublicIpByPrivateIpIdDetails. + :rtype: str + """ + return self._private_ip_id + + @private_ip_id.setter + def private_ip_id(self, private_ip_id): + """ + Sets the private_ip_id of this GetPublicIpByPrivateIpIdDetails. + OCID of the private IP. + + + :param private_ip_id: The private_ip_id of this GetPublicIpByPrivateIpIdDetails. + :type: str + """ + self._private_ip_id = private_ip_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/core/models/i_scsi_volume_attachment.py b/src/oci/core/models/i_scsi_volume_attachment.py index cb078c69fa..e7a426ef54 100644 --- a/src/oci/core/models/i_scsi_volume_attachment.py +++ b/src/oci/core/models/i_scsi_volume_attachment.py @@ -39,6 +39,10 @@ def __init__(self, **kwargs): The value to assign to the instance_id property of this IScsiVolumeAttachment. :type instance_id: str + :param is_read_only: + The value to assign to the is_read_only property of this IScsiVolumeAttachment. + :type is_read_only: bool + :param lifecycle_state: The value to assign to the lifecycle_state property of this IScsiVolumeAttachment. Allowed values for this property are: "ATTACHING", "ATTACHED", "DETACHING", "DETACHED" @@ -80,6 +84,7 @@ def __init__(self, **kwargs): 'display_name': 'str', 'id': 'str', 'instance_id': 'str', + 'is_read_only': 'bool', 'lifecycle_state': 'str', 'time_created': 'datetime', 'volume_id': 'str', @@ -97,6 +102,7 @@ def __init__(self, **kwargs): 'display_name': 'displayName', 'id': 'id', 'instance_id': 'instanceId', + 'is_read_only': 'isReadOnly', 'lifecycle_state': 'lifecycleState', 'time_created': 'timeCreated', 'volume_id': 'volumeId', @@ -113,6 +119,7 @@ def __init__(self, **kwargs): self._display_name = None self._id = None self._instance_id = None + self._is_read_only = None self._lifecycle_state = None self._time_created = None self._volume_id = None diff --git a/src/oci/core/models/public_ip.py b/src/oci/core/models/public_ip.py new file mode 100644 index 0000000000..173117bdee --- /dev/null +++ b/src/oci/core/models/public_ip.py @@ -0,0 +1,433 @@ +# 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 PublicIp(object): + + def __init__(self, **kwargs): + """ + Initializes a new PublicIp 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 PublicIp. + :type availability_domain: str + + :param compartment_id: + The value to assign to the compartment_id property of this PublicIp. + :type compartment_id: str + + :param display_name: + The value to assign to the display_name property of this PublicIp. + :type display_name: str + + :param id: + The value to assign to the id property of this PublicIp. + :type id: str + + :param ip_address: + The value to assign to the ip_address property of this PublicIp. + :type ip_address: str + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this PublicIp. + Allowed values for this property are: "PROVISIONING", "AVAILABLE", "ASSIGNING", "ASSIGNED", "UNASSIGNING", "UNASSIGNED", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + :param lifetime: + The value to assign to the lifetime property of this PublicIp. + Allowed values for this property are: "EPHEMERAL", "RESERVED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifetime: str + + :param private_ip_id: + The value to assign to the private_ip_id property of this PublicIp. + :type private_ip_id: str + + :param scope: + The value to assign to the scope property of this PublicIp. + Allowed values for this property are: "REGION", "AVAILABILITY_DOMAIN", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type scope: str + + :param time_created: + The value to assign to the time_created property of this PublicIp. + :type time_created: datetime + + """ + self.swagger_types = { + 'availability_domain': 'str', + 'compartment_id': 'str', + 'display_name': 'str', + 'id': 'str', + 'ip_address': 'str', + 'lifecycle_state': 'str', + 'lifetime': 'str', + 'private_ip_id': 'str', + 'scope': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'availability_domain': 'availabilityDomain', + 'compartment_id': 'compartmentId', + 'display_name': 'displayName', + 'id': 'id', + 'ip_address': 'ipAddress', + 'lifecycle_state': 'lifecycleState', + 'lifetime': 'lifetime', + 'private_ip_id': 'privateIpId', + 'scope': 'scope', + 'time_created': 'timeCreated' + } + + self._availability_domain = None + self._compartment_id = None + self._display_name = None + self._id = None + self._ip_address = None + self._lifecycle_state = None + self._lifetime = None + self._private_ip_id = None + self._scope = None + self._time_created = None + + @property + def availability_domain(self): + """ + Gets the availability_domain of this PublicIp. + The public IP's Availability Domain. This property is set only for ephemeral public IPs + (that is, when the `scope` of the public IP is set to AVAILABILITY_DOMAIN). The value + is the Availability Domain of the assigned private IP. + + Example: `Uocm:PHX-AD-1` + + + :return: The availability_domain of this PublicIp. + :rtype: str + """ + return self._availability_domain + + @availability_domain.setter + def availability_domain(self, availability_domain): + """ + Sets the availability_domain of this PublicIp. + The public IP's Availability Domain. This property is set only for ephemeral public IPs + (that is, when the `scope` of the public IP is set to AVAILABILITY_DOMAIN). The value + is the Availability Domain of the assigned private IP. + + Example: `Uocm:PHX-AD-1` + + + :param availability_domain: The availability_domain of this PublicIp. + :type: str + """ + self._availability_domain = availability_domain + + @property + def compartment_id(self): + """ + Gets the compartment_id of this PublicIp. + The OCID of the compartment containing the public IP. For an ephemeral public IP, this is + the same compartment as the private IP's. For a reserved public IP that is currently assigned, + this can be a different compartment than the assigned private IP's. + + + :return: The compartment_id of this PublicIp. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this PublicIp. + The OCID of the compartment containing the public IP. For an ephemeral public IP, this is + the same compartment as the private IP's. For a reserved public IP that is currently assigned, + this can be a different compartment than the assigned private IP's. + + + :param compartment_id: The compartment_id of this PublicIp. + :type: str + """ + self._compartment_id = compartment_id + + @property + def display_name(self): + """ + Gets the display_name of this PublicIp. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :return: The display_name of this PublicIp. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this PublicIp. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :param display_name: The display_name of this PublicIp. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + Gets the id of this PublicIp. + The public IP's Oracle ID (OCID). + + + :return: The id of this PublicIp. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this PublicIp. + The public IP's Oracle ID (OCID). + + + :param id: The id of this PublicIp. + :type: str + """ + self._id = id + + @property + def ip_address(self): + """ + Gets the ip_address of this PublicIp. + The public IP address of the `publicIp` object. + + Example: `129.146.2.1` + + + :return: The ip_address of this PublicIp. + :rtype: str + """ + return self._ip_address + + @ip_address.setter + def ip_address(self, ip_address): + """ + Sets the ip_address of this PublicIp. + The public IP address of the `publicIp` object. + + Example: `129.146.2.1` + + + :param ip_address: The ip_address of this PublicIp. + :type: str + """ + self._ip_address = ip_address + + @property + def lifecycle_state(self): + """ + Gets the lifecycle_state of this PublicIp. + The public IP's current state. + + Allowed values for this property are: "PROVISIONING", "AVAILABLE", "ASSIGNING", "ASSIGNED", "UNASSIGNING", "UNASSIGNED", "TERMINATING", "TERMINATED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this PublicIp. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this PublicIp. + The public IP's current state. + + + :param lifecycle_state: The lifecycle_state of this PublicIp. + :type: str + """ + allowed_values = ["PROVISIONING", "AVAILABLE", "ASSIGNING", "ASSIGNED", "UNASSIGNING", "UNASSIGNED", "TERMINATING", "TERMINATED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + @property + def lifetime(self): + """ + Gets the lifetime of this PublicIp. + Defines when the public IP is deleted and released back to Oracle's public IP pool. + + * `EPHEMERAL`: The lifetime is tied to the lifetime of its assigned private IP. The + ephemeral public IP is automatically deleted when its private IP is deleted, when + the VNIC is terminated, or when the instance is terminated. An ephemeral + public IP must always be assigned to a private IP. + + * `RESERVED`: You control the public IP's lifetime. You can delete a reserved public IP + whenever you like. It does not need to be assigned to a private IP at all times. + + For more information and comparison of the two types, + see `Public IP Addresses`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + Allowed values for this property are: "EPHEMERAL", "RESERVED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifetime of this PublicIp. + :rtype: str + """ + return self._lifetime + + @lifetime.setter + def lifetime(self, lifetime): + """ + Sets the lifetime of this PublicIp. + Defines when the public IP is deleted and released back to Oracle's public IP pool. + + * `EPHEMERAL`: The lifetime is tied to the lifetime of its assigned private IP. The + ephemeral public IP is automatically deleted when its private IP is deleted, when + the VNIC is terminated, or when the instance is terminated. An ephemeral + public IP must always be assigned to a private IP. + + * `RESERVED`: You control the public IP's lifetime. You can delete a reserved public IP + whenever you like. It does not need to be assigned to a private IP at all times. + + For more information and comparison of the two types, + see `Public IP Addresses`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + + :param lifetime: The lifetime of this PublicIp. + :type: str + """ + allowed_values = ["EPHEMERAL", "RESERVED"] + if not value_allowed_none_or_none_sentinel(lifetime, allowed_values): + lifetime = 'UNKNOWN_ENUM_VALUE' + self._lifetime = lifetime + + @property + def private_ip_id(self): + """ + Gets the private_ip_id of this PublicIp. + The OCID of the private IP that the public IP is currently assigned to, or in the + process of being assigned to. + + + :return: The private_ip_id of this PublicIp. + :rtype: str + """ + return self._private_ip_id + + @private_ip_id.setter + def private_ip_id(self, private_ip_id): + """ + Sets the private_ip_id of this PublicIp. + The OCID of the private IP that the public IP is currently assigned to, or in the + process of being assigned to. + + + :param private_ip_id: The private_ip_id of this PublicIp. + :type: str + """ + self._private_ip_id = private_ip_id + + @property + def scope(self): + """ + Gets the scope of this PublicIp. + Whether the public IP is regional or specific to a particular Availability Domain. + + * `REGION`: The public IP exists within a region and can be assigned to a private IP + in any Availability Domain in the region. Reserved public IPs have `scope` = `REGION`. + + * `AVAILABILITY_DOMAIN`: The public IP exists within the Availability Domain of the private IP + it's assigned to, which is specified by the `availabilityDomain` property of the public IP object. + Ephemeral public IPs have `scope` = `AVAILABILITY_DOMAIN`. + + Allowed values for this property are: "REGION", "AVAILABILITY_DOMAIN", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The scope of this PublicIp. + :rtype: str + """ + return self._scope + + @scope.setter + def scope(self, scope): + """ + Sets the scope of this PublicIp. + Whether the public IP is regional or specific to a particular Availability Domain. + + * `REGION`: The public IP exists within a region and can be assigned to a private IP + in any Availability Domain in the region. Reserved public IPs have `scope` = `REGION`. + + * `AVAILABILITY_DOMAIN`: The public IP exists within the Availability Domain of the private IP + it's assigned to, which is specified by the `availabilityDomain` property of the public IP object. + Ephemeral public IPs have `scope` = `AVAILABILITY_DOMAIN`. + + + :param scope: The scope of this PublicIp. + :type: str + """ + allowed_values = ["REGION", "AVAILABILITY_DOMAIN"] + if not value_allowed_none_or_none_sentinel(scope, allowed_values): + scope = 'UNKNOWN_ENUM_VALUE' + self._scope = scope + + @property + def time_created(self): + """ + Gets the time_created of this PublicIp. + The date and time the public IP was created, in the format defined by RFC3339. + + Example: `2016-08-25T21:10:29.600Z` + + + :return: The time_created of this PublicIp. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this PublicIp. + The date and time the public IP was created, in the format defined by RFC3339. + + Example: `2016-08-25T21:10:29.600Z` + + + :param time_created: The time_created of this PublicIp. + :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/core/models/update_public_ip_details.py b/src/oci/core/models/update_public_ip_details.py new file mode 100644 index 0000000000..78d6bbb772 --- /dev/null +++ b/src/oci/core/models/update_public_ip_details.py @@ -0,0 +1,107 @@ +# 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 UpdatePublicIpDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdatePublicIpDetails 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 UpdatePublicIpDetails. + :type display_name: str + + :param private_ip_id: + The value to assign to the private_ip_id property of this UpdatePublicIpDetails. + :type private_ip_id: str + + """ + self.swagger_types = { + 'display_name': 'str', + 'private_ip_id': 'str' + } + + self.attribute_map = { + 'display_name': 'displayName', + 'private_ip_id': 'privateIpId' + } + + self._display_name = None + self._private_ip_id = None + + @property + def display_name(self): + """ + Gets the display_name of this UpdatePublicIpDetails. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :return: The display_name of this UpdatePublicIpDetails. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this UpdatePublicIpDetails. + A user-friendly name. Does not have to be unique, and it's changeable. Avoid + entering confidential information. + + + :param display_name: The display_name of this UpdatePublicIpDetails. + :type: str + """ + self._display_name = display_name + + @property + def private_ip_id(self): + """ + Gets the private_ip_id of this UpdatePublicIpDetails. + The OCID of the private IP to assign the public IP to. + * If the public IP is already assigned to a different private IP, it will be unassigned + and then reassigned to the specified private IP. + * If you set this field to an empty string, the public IP will be unassigned from the + private IP it is currently assigned to. + + + :return: The private_ip_id of this UpdatePublicIpDetails. + :rtype: str + """ + return self._private_ip_id + + @private_ip_id.setter + def private_ip_id(self, private_ip_id): + """ + Sets the private_ip_id of this UpdatePublicIpDetails. + The OCID of the private IP to assign the public IP to. + * If the public IP is already assigned to a different private IP, it will be unassigned + and then reassigned to the specified private IP. + * If you set this field to an empty string, the public IP will be unassigned from the + private IP it is currently assigned to. + + + :param private_ip_id: The private_ip_id of this UpdatePublicIpDetails. + :type: str + """ + self._private_ip_id = private_ip_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/core/models/volume_attachment.py b/src/oci/core/models/volume_attachment.py index 2554d53df3..596d6d8b0e 100644 --- a/src/oci/core/models/volume_attachment.py +++ b/src/oci/core/models/volume_attachment.py @@ -42,6 +42,10 @@ def __init__(self, **kwargs): The value to assign to the instance_id property of this VolumeAttachment. :type instance_id: str + :param is_read_only: + The value to assign to the is_read_only property of this VolumeAttachment. + :type is_read_only: bool + :param lifecycle_state: The value to assign to the lifecycle_state property of this VolumeAttachment. Allowed values for this property are: "ATTACHING", "ATTACHED", "DETACHING", "DETACHED", 'UNKNOWN_ENUM_VALUE'. @@ -64,6 +68,7 @@ def __init__(self, **kwargs): 'display_name': 'str', 'id': 'str', 'instance_id': 'str', + 'is_read_only': 'bool', 'lifecycle_state': 'str', 'time_created': 'datetime', 'volume_id': 'str' @@ -76,6 +81,7 @@ def __init__(self, **kwargs): 'display_name': 'displayName', 'id': 'id', 'instance_id': 'instanceId', + 'is_read_only': 'isReadOnly', 'lifecycle_state': 'lifecycleState', 'time_created': 'timeCreated', 'volume_id': 'volumeId' @@ -87,6 +93,7 @@ def __init__(self, **kwargs): self._display_name = None self._id = None self._instance_id = None + self._is_read_only = None self._lifecycle_state = None self._time_created = None self._volume_id = None @@ -258,6 +265,30 @@ def instance_id(self, instance_id): """ self._instance_id = instance_id + @property + def is_read_only(self): + """ + Gets the is_read_only of this VolumeAttachment. + Whether the attachment was created in read-only mode. + + + :return: The is_read_only of this VolumeAttachment. + :rtype: bool + """ + return self._is_read_only + + @is_read_only.setter + def is_read_only(self, is_read_only): + """ + Sets the is_read_only of this VolumeAttachment. + Whether the attachment was created in read-only mode. + + + :param is_read_only: The is_read_only of this VolumeAttachment. + :type: bool + """ + self._is_read_only = is_read_only + @property def lifecycle_state(self): """ diff --git a/src/oci/core/models/volume_backup.py b/src/oci/core/models/volume_backup.py index 6f96e40ca2..203c1c5a72 100644 --- a/src/oci/core/models/volume_backup.py +++ b/src/oci/core/models/volume_backup.py @@ -26,6 +26,10 @@ def __init__(self, **kwargs): The value to assign to the display_name property of this VolumeBackup. :type display_name: str + :param expiration_time: + The value to assign to the expiration_time property of this VolumeBackup. + :type expiration_time: datetime + :param freeform_tags: The value to assign to the freeform_tags property of this VolumeBackup. :type freeform_tags: dict(str, str) @@ -48,6 +52,12 @@ def __init__(self, **kwargs): The value to assign to the size_in_mbs property of this VolumeBackup. :type size_in_mbs: int + :param source_type: + The value to assign to the source_type property of this VolumeBackup. + Allowed values for this property are: "MANUAL", "SCHEDULED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type source_type: str + :param time_created: The value to assign to the time_created property of this VolumeBackup. :type time_created: datetime @@ -56,6 +66,12 @@ def __init__(self, **kwargs): The value to assign to the time_request_received property of this VolumeBackup. :type time_request_received: datetime + :param type: + The value to assign to the type property of this VolumeBackup. + Allowed values for this property are: "FULL", "INCREMENTAL", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type type: str + :param unique_size_in_gbs: The value to assign to the unique_size_in_gbs property of this VolumeBackup. :type unique_size_in_gbs: int @@ -73,13 +89,16 @@ def __init__(self, **kwargs): 'compartment_id': 'str', 'defined_tags': 'dict(str, dict(str, object))', 'display_name': 'str', + 'expiration_time': 'datetime', 'freeform_tags': 'dict(str, str)', 'id': 'str', 'lifecycle_state': 'str', 'size_in_gbs': 'int', 'size_in_mbs': 'int', + 'source_type': 'str', 'time_created': 'datetime', 'time_request_received': 'datetime', + 'type': 'str', 'unique_size_in_gbs': 'int', 'unique_size_in_mbs': 'int', 'volume_id': 'str' @@ -89,13 +108,16 @@ def __init__(self, **kwargs): 'compartment_id': 'compartmentId', 'defined_tags': 'definedTags', 'display_name': 'displayName', + 'expiration_time': 'expirationTime', 'freeform_tags': 'freeformTags', 'id': 'id', 'lifecycle_state': 'lifecycleState', 'size_in_gbs': 'sizeInGBs', 'size_in_mbs': 'sizeInMBs', + 'source_type': 'sourceType', 'time_created': 'timeCreated', 'time_request_received': 'timeRequestReceived', + 'type': 'type', 'unique_size_in_gbs': 'uniqueSizeInGBs', 'unique_size_in_mbs': 'uniqueSizeInMbs', 'volume_id': 'volumeId' @@ -104,13 +126,16 @@ def __init__(self, **kwargs): self._compartment_id = None self._defined_tags = None self._display_name = None + self._expiration_time = None self._freeform_tags = None self._id = None self._lifecycle_state = None self._size_in_gbs = None self._size_in_mbs = None + self._source_type = None self._time_created = None self._time_request_received = None + self._type = None self._unique_size_in_gbs = None self._unique_size_in_mbs = None self._volume_id = None @@ -199,6 +224,38 @@ def display_name(self, display_name): """ self._display_name = display_name + @property + def expiration_time(self): + """ + Gets the expiration_time of this VolumeBackup. + The date and time the volume backup will expire and be automatically deleted. + Format defined by RFC3339. This parameter will always be present for backups that + were created automatically by a scheduled-backup policy. For manually created backups, + it will be absent, signifying that there is no expiration time and the backup will + last forever until manually deleted. + + + :return: The expiration_time of this VolumeBackup. + :rtype: datetime + """ + return self._expiration_time + + @expiration_time.setter + def expiration_time(self, expiration_time): + """ + Sets the expiration_time of this VolumeBackup. + The date and time the volume backup will expire and be automatically deleted. + Format defined by RFC3339. This parameter will always be present for backups that + were created automatically by a scheduled-backup policy. For manually created backups, + it will be absent, signifying that there is no expiration time and the backup will + last forever until manually deleted. + + + :param expiration_time: The expiration_time of this VolumeBackup. + :type: datetime + """ + self._expiration_time = expiration_time + @property def freeform_tags(self): """ @@ -339,6 +396,36 @@ def size_in_mbs(self, size_in_mbs): """ self._size_in_mbs = size_in_mbs + @property + def source_type(self): + """ + Gets the source_type of this VolumeBackup. + Specifies whether the backup was created manually, or via scheduled backup policy. + + Allowed values for this property are: "MANUAL", "SCHEDULED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The source_type of this VolumeBackup. + :rtype: str + """ + return self._source_type + + @source_type.setter + def source_type(self, source_type): + """ + Sets the source_type of this VolumeBackup. + Specifies whether the backup was created manually, or via scheduled backup policy. + + + :param source_type: The source_type of this VolumeBackup. + :type: str + """ + allowed_values = ["MANUAL", "SCHEDULED"] + if not value_allowed_none_or_none_sentinel(source_type, allowed_values): + source_type = 'UNKNOWN_ENUM_VALUE' + self._source_type = source_type + @property def time_created(self): """ @@ -389,6 +476,36 @@ def time_request_received(self, time_request_received): """ self._time_request_received = time_request_received + @property + def type(self): + """ + **[Required]** Gets the type of this VolumeBackup. + The type of a volume backup. + + Allowed values for this property are: "FULL", "INCREMENTAL", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The type of this VolumeBackup. + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """ + Sets the type of this VolumeBackup. + The type of a volume backup. + + + :param type: The type of this VolumeBackup. + :type: str + """ + allowed_values = ["FULL", "INCREMENTAL"] + if not value_allowed_none_or_none_sentinel(type, allowed_values): + type = 'UNKNOWN_ENUM_VALUE' + self._type = type + @property def unique_size_in_gbs(self): """ diff --git a/src/oci/core/models/volume_backup_policy.py b/src/oci/core/models/volume_backup_policy.py new file mode 100644 index 0000000000..df7adeef01 --- /dev/null +++ b/src/oci/core/models/volume_backup_policy.py @@ -0,0 +1,161 @@ +# 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 VolumeBackupPolicy(object): + + def __init__(self, **kwargs): + """ + Initializes a new VolumeBackupPolicy 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 VolumeBackupPolicy. + :type display_name: str + + :param id: + The value to assign to the id property of this VolumeBackupPolicy. + :type id: str + + :param schedules: + The value to assign to the schedules property of this VolumeBackupPolicy. + :type schedules: list[VolumeBackupSchedule] + + :param time_created: + The value to assign to the time_created property of this VolumeBackupPolicy. + :type time_created: datetime + + """ + self.swagger_types = { + 'display_name': 'str', + 'id': 'str', + 'schedules': 'list[VolumeBackupSchedule]', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'display_name': 'displayName', + 'id': 'id', + 'schedules': 'schedules', + 'time_created': 'timeCreated' + } + + self._display_name = None + self._id = None + self._schedules = None + self._time_created = None + + @property + def display_name(self): + """ + **[Required]** Gets the display_name of this VolumeBackupPolicy. + A user-friendly name for the volume backup policy. Does not have to be unique and it's changeable. + Avoid entering confidential information. + + + :return: The display_name of this VolumeBackupPolicy. + :rtype: str + """ + return self._display_name + + @display_name.setter + def display_name(self, display_name): + """ + Sets the display_name of this VolumeBackupPolicy. + A user-friendly name for the volume backup policy. Does not have to be unique and it's changeable. + Avoid entering confidential information. + + + :param display_name: The display_name of this VolumeBackupPolicy. + :type: str + """ + self._display_name = display_name + + @property + def id(self): + """ + **[Required]** Gets the id of this VolumeBackupPolicy. + The OCID of the volume backup policy. + + + :return: The id of this VolumeBackupPolicy. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this VolumeBackupPolicy. + The OCID of the volume backup policy. + + + :param id: The id of this VolumeBackupPolicy. + :type: str + """ + self._id = id + + @property + def schedules(self): + """ + **[Required]** Gets the schedules of this VolumeBackupPolicy. + The collection of schedules that this policy will apply. + + + :return: The schedules of this VolumeBackupPolicy. + :rtype: list[VolumeBackupSchedule] + """ + return self._schedules + + @schedules.setter + def schedules(self, schedules): + """ + Sets the schedules of this VolumeBackupPolicy. + The collection of schedules that this policy will apply. + + + :param schedules: The schedules of this VolumeBackupPolicy. + :type: list[VolumeBackupSchedule] + """ + self._schedules = schedules + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this VolumeBackupPolicy. + The date and time the volume backup policy was created. Format defined by RFC3339. + + + :return: The time_created of this VolumeBackupPolicy. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this VolumeBackupPolicy. + The date and time the volume backup policy was created. Format defined by RFC3339. + + + :param time_created: The time_created of this VolumeBackupPolicy. + :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/core/models/volume_backup_policy_assignment.py b/src/oci/core/models/volume_backup_policy_assignment.py new file mode 100644 index 0000000000..ae35a369b6 --- /dev/null +++ b/src/oci/core/models/volume_backup_policy_assignment.py @@ -0,0 +1,159 @@ +# 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 VolumeBackupPolicyAssignment(object): + + def __init__(self, **kwargs): + """ + Initializes a new VolumeBackupPolicyAssignment object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param asset_id: + The value to assign to the asset_id property of this VolumeBackupPolicyAssignment. + :type asset_id: str + + :param id: + The value to assign to the id property of this VolumeBackupPolicyAssignment. + :type id: str + + :param policy_id: + The value to assign to the policy_id property of this VolumeBackupPolicyAssignment. + :type policy_id: str + + :param time_created: + The value to assign to the time_created property of this VolumeBackupPolicyAssignment. + :type time_created: datetime + + """ + self.swagger_types = { + 'asset_id': 'str', + 'id': 'str', + 'policy_id': 'str', + 'time_created': 'datetime' + } + + self.attribute_map = { + 'asset_id': 'assetId', + 'id': 'id', + 'policy_id': 'policyId', + 'time_created': 'timeCreated' + } + + self._asset_id = None + self._id = None + self._policy_id = None + self._time_created = None + + @property + def asset_id(self): + """ + **[Required]** Gets the asset_id of this VolumeBackupPolicyAssignment. + The OCID of the asset (e.g. a volume) to which the policy has been assigned. + + + :return: The asset_id of this VolumeBackupPolicyAssignment. + :rtype: str + """ + return self._asset_id + + @asset_id.setter + def asset_id(self, asset_id): + """ + Sets the asset_id of this VolumeBackupPolicyAssignment. + The OCID of the asset (e.g. a volume) to which the policy has been assigned. + + + :param asset_id: The asset_id of this VolumeBackupPolicyAssignment. + :type: str + """ + self._asset_id = asset_id + + @property + def id(self): + """ + **[Required]** Gets the id of this VolumeBackupPolicyAssignment. + The OCID of the volume backup policy assignment. + + + :return: The id of this VolumeBackupPolicyAssignment. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this VolumeBackupPolicyAssignment. + The OCID of the volume backup policy assignment. + + + :param id: The id of this VolumeBackupPolicyAssignment. + :type: str + """ + self._id = id + + @property + def policy_id(self): + """ + **[Required]** Gets the policy_id of this VolumeBackupPolicyAssignment. + The OCID of the volume backup policy that has been assigned to an asset. + + + :return: The policy_id of this VolumeBackupPolicyAssignment. + :rtype: str + """ + return self._policy_id + + @policy_id.setter + def policy_id(self, policy_id): + """ + Sets the policy_id of this VolumeBackupPolicyAssignment. + The OCID of the volume backup policy that has been assigned to an asset. + + + :param policy_id: The policy_id of this VolumeBackupPolicyAssignment. + :type: str + """ + self._policy_id = policy_id + + @property + def time_created(self): + """ + **[Required]** Gets the time_created of this VolumeBackupPolicyAssignment. + The date and time the volume backup policy assignment was created. Format defined by RFC3339. + + + :return: The time_created of this VolumeBackupPolicyAssignment. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this VolumeBackupPolicyAssignment. + The date and time the volume backup policy assignment was created. Format defined by RFC3339. + + + :param time_created: The time_created of this VolumeBackupPolicyAssignment. + :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/core/models/volume_backup_schedule.py b/src/oci/core/models/volume_backup_schedule.py new file mode 100644 index 0000000000..72ef69a69b --- /dev/null +++ b/src/oci/core/models/volume_backup_schedule.py @@ -0,0 +1,175 @@ +# 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 VolumeBackupSchedule(object): + + def __init__(self, **kwargs): + """ + Initializes a new VolumeBackupSchedule object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param backup_type: + The value to assign to the backup_type property of this VolumeBackupSchedule. + Allowed values for this property are: "FULL", "INCREMENTAL", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type backup_type: str + + :param offset_seconds: + The value to assign to the offset_seconds property of this VolumeBackupSchedule. + :type offset_seconds: int + + :param period: + The value to assign to the period property of this VolumeBackupSchedule. + Allowed values for this property are: "ONE_HOUR", "ONE_DAY", "ONE_WEEK", "ONE_MONTH", "ONE_YEAR", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type period: str + + :param retention_seconds: + The value to assign to the retention_seconds property of this VolumeBackupSchedule. + :type retention_seconds: int + + """ + self.swagger_types = { + 'backup_type': 'str', + 'offset_seconds': 'int', + 'period': 'str', + 'retention_seconds': 'int' + } + + self.attribute_map = { + 'backup_type': 'backupType', + 'offset_seconds': 'offsetSeconds', + 'period': 'period', + 'retention_seconds': 'retentionSeconds' + } + + self._backup_type = None + self._offset_seconds = None + self._period = None + self._retention_seconds = None + + @property + def backup_type(self): + """ + **[Required]** Gets the backup_type of this VolumeBackupSchedule. + The type of backup to create. + + Allowed values for this property are: "FULL", "INCREMENTAL", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The backup_type of this VolumeBackupSchedule. + :rtype: str + """ + return self._backup_type + + @backup_type.setter + def backup_type(self, backup_type): + """ + Sets the backup_type of this VolumeBackupSchedule. + The type of backup to create. + + + :param backup_type: The backup_type of this VolumeBackupSchedule. + :type: str + """ + allowed_values = ["FULL", "INCREMENTAL"] + if not value_allowed_none_or_none_sentinel(backup_type, allowed_values): + backup_type = 'UNKNOWN_ENUM_VALUE' + self._backup_type = backup_type + + @property + def offset_seconds(self): + """ + **[Required]** Gets the offset_seconds of this VolumeBackupSchedule. + The number of seconds (positive or negative) that the backup time should be shifted from the default interval boundaries specified by the period. + + + :return: The offset_seconds of this VolumeBackupSchedule. + :rtype: int + """ + return self._offset_seconds + + @offset_seconds.setter + def offset_seconds(self, offset_seconds): + """ + Sets the offset_seconds of this VolumeBackupSchedule. + The number of seconds (positive or negative) that the backup time should be shifted from the default interval boundaries specified by the period. + + + :param offset_seconds: The offset_seconds of this VolumeBackupSchedule. + :type: int + """ + self._offset_seconds = offset_seconds + + @property + def period(self): + """ + **[Required]** Gets the period of this VolumeBackupSchedule. + How often the backup should occur. + + Allowed values for this property are: "ONE_HOUR", "ONE_DAY", "ONE_WEEK", "ONE_MONTH", "ONE_YEAR", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The period of this VolumeBackupSchedule. + :rtype: str + """ + return self._period + + @period.setter + def period(self, period): + """ + Sets the period of this VolumeBackupSchedule. + How often the backup should occur. + + + :param period: The period of this VolumeBackupSchedule. + :type: str + """ + allowed_values = ["ONE_HOUR", "ONE_DAY", "ONE_WEEK", "ONE_MONTH", "ONE_YEAR"] + if not value_allowed_none_or_none_sentinel(period, allowed_values): + period = 'UNKNOWN_ENUM_VALUE' + self._period = period + + @property + def retention_seconds(self): + """ + **[Required]** Gets the retention_seconds of this VolumeBackupSchedule. + How long, in seconds, backups created by this schedule should be kept until being automatically deleted. + + + :return: The retention_seconds of this VolumeBackupSchedule. + :rtype: int + """ + return self._retention_seconds + + @retention_seconds.setter + def retention_seconds(self, retention_seconds): + """ + Sets the retention_seconds of this VolumeBackupSchedule. + How long, in seconds, backups created by this schedule should be kept until being automatically deleted. + + + :param retention_seconds: The retention_seconds of this VolumeBackupSchedule. + :type: int + """ + self._retention_seconds = retention_seconds + + 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/core/virtual_network_client.py b/src/oci/core/virtual_network_client.py index af8a13868c..a920b65d76 100644 --- a/src/oci/core/virtual_network_client.py +++ b/src/oci/core/virtual_network_client.py @@ -941,6 +941,84 @@ def create_private_ip(self, create_private_ip_details, **kwargs): body=create_private_ip_details, response_type="PrivateIp") + def create_public_ip(self, create_public_ip_details, **kwargs): + """ + CreatePublicIp + Creates a public IP. Use the `lifetime` property to specify whether it's an ephemeral or + reserved public IP. For information about limits on how many you can create, see + `Public IP Addresses`__. + + * **For an ephemeral public IP:** You must also specify a `privateIpId` with the OCID of + the primary private IP you want to assign the public IP to. The public IP is created in + the same Availability Domain as the private IP. An ephemeral public IP must always be + assigned to a private IP, and only to the *primary* private IP on a VNIC, not a secondary + private IP. + + * **For a reserved public IP:** You may also optionally assign the public IP to a private + IP by specifying `privateIpId`. Or you can later assign the public IP with + :func:`update_public_ip`. + + **Note:** When assigning a public IP to a private IP, the private IP must not already have + a public IP with `lifecycleState` = ASSIGNING or ASSIGNED. If it does, an error is returned. + + Also, for reserved public IPs, the optional assignment part of this operation is + asynchronous. Poll the public IP's `lifecycleState` to determine if the assignment + succeeded. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + + :param CreatePublicIpDetails create_public_ip_details: (required) + Create public IP details. + + :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 + may be rejected). + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps" + 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_public_ip 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_public_ip_details, + response_type="PublicIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=create_public_ip_details, + response_type="PublicIp") + def create_route_table(self, create_route_table_details, **kwargs): """ CreateRouteTable @@ -1958,7 +2036,7 @@ def delete_private_ip(self, private_ip_id, **kwargs): :param str private_ip_id: (required) - The private IP's OCID. + The OCID of the private IP. :param str if_match: (optional) For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` @@ -2012,6 +2090,77 @@ def delete_private_ip(self, private_ip_id, **kwargs): path_params=path_params, header_params=header_params) + def delete_public_ip(self, public_ip_id, **kwargs): + """ + DeletePublicIp + Unassigns and deletes the specified public IP (either ephemeral or reserved). + You must specify the object's OCID. The public IP address is returned to the + Oracle Cloud Infrastructure public IP pool. + + For an assigned reserved public IP, the initial unassignment portion of this operation + is asynchronous. Poll the public IP's `lifecycleState` to determine + if the operation succeeded. + + If you want to simply unassign a reserved public IP and return it to your pool + of reserved public IPs, instead use + :func:`update_public_ip`. + + + :param str public_ip_id: (required) + The OCID of the public IP. + + :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 = "/publicIps/{publicIpId}" + 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_public_ip got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "publicIpId": public_ip_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_route_table(self, rt_id, **kwargs): """ DeleteRouteTable @@ -3077,7 +3226,7 @@ def get_private_ip(self, private_ip_id, **kwargs): :param str private_ip_id: (required) - The private IP's OCID. + The OCID of the private IP. :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.PrivateIp` :rtype: :class:`~oci.response.Response` @@ -3122,6 +3271,166 @@ def get_private_ip(self, private_ip_id, **kwargs): header_params=header_params, response_type="PrivateIp") + def get_public_ip(self, public_ip_id, **kwargs): + """ + GetPublicIp + Gets the specified public IP. You must specify the object's OCID. + + Alternatively, you can get the object by using :func:`get_public_ip_by_ip_address` + with the public IP address (for example, 129.146.2.1). + + Or you can use :func:`get_public_ip_by_private_ip_id` + with the OCID of the private IP that the public IP is assigned to. + + **Note:** If you're fetching a reserved public IP that is in the process of being + moved to a different private IP, the service returns the public IP object with + `lifecycleState` = ASSIGNING and `privateIpId` = OCID of the target private IP. + + + :param str public_ip_id: (required) + The OCID of the public IP. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps/{publicIpId}" + 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_public_ip got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "publicIpId": public_ip_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="PublicIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PublicIp") + + def get_public_ip_by_ip_address(self, get_public_ip_by_ip_address_details, **kwargs): + """ + GetPublicIpByIpAddress + Gets the public IP based on the public IP address (for example, 129.146.2.1). + + **Note:** If you're fetching a reserved public IP that is in the process of being + moved to a different private IP, the service returns the public IP object with + `lifecycleState` = ASSIGNING and `privateIpId` = OCID of the target private IP. + + + :param GetPublicIpByIpAddressDetails get_public_ip_by_ip_address_details: (required) + IP address details for fetching the public IP. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps/actions/getByIpAddress" + method = "POST" + + 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_public_ip_by_ip_address got unknown kwargs: {!r}".format(extra_kwargs)) + + 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, + header_params=header_params, + body=get_public_ip_by_ip_address_details, + response_type="PublicIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=get_public_ip_by_ip_address_details, + response_type="PublicIp") + + def get_public_ip_by_private_ip_id(self, get_public_ip_by_private_ip_id_details, **kwargs): + """ + GetPublicIpByPrivateIpId + Gets the public IP assigned to the specified private IP. You must specify the OCID + of the private IP. If no public IP is assigned, a 404 is returned. + + **Note:** If you're fetching a reserved public IP that is in the process of being + moved to a different private IP, and you provide the OCID of the original private + IP, this operation returns a 404. If you instead provide the OCID of the target + private IP, or if you instead call + :func:`get_public_ip` or + :func:`get_public_ip_by_ip_address`, the + service returns the public IP object with `lifecycleState` = ASSIGNING and `privateIpId` = OCID + of the target private IP. + + + :param GetPublicIpByPrivateIpIdDetails get_public_ip_by_private_ip_id_details: (required) + Private IP details for fetching the public IP. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps/actions/getByPrivateIpId" + method = "POST" + + 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_public_ip_by_private_ip_id got unknown kwargs: {!r}".format(extra_kwargs)) + + 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, + header_params=header_params, + body=get_public_ip_by_private_ip_id_details, + response_type="PublicIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + header_params=header_params, + body=get_public_ip_by_private_ip_id_details, + response_type="PublicIp") + def get_route_table(self, rt_id, **kwargs): """ GetRouteTable @@ -4560,7 +4869,7 @@ def list_private_ips(self, **kwargs): The value of the `opc-next-page` response header from the previous \"List\" call. :param str ip_address: (optional) - The private IP address of the `privateIp` object. + An IP address. Example: `10.0.3.3` @@ -4620,6 +4929,102 @@ def list_private_ips(self, **kwargs): header_params=header_params, response_type="list[PrivateIp]") + def list_public_ips(self, scope, compartment_id, **kwargs): + """ + ListPublicIps + Lists either the ephemeral or reserved :class:`PublicIp` objects + in the specified compartment. + + To list your reserved public IPs, set `scope` = `REGION`, and leave the + `availabilityDomain` parameter empty. + + To list your ephemeral public IPs, set `scope` = `AVAILABILITY_DOMAIN`, and set the + `availabilityDomain` parameter to the desired Availability Domain. An ephemeral public IP + is always in the same Availability Domain and compartment as the private IP it's assigned to. + + + :param str scope: (required) + Whether the public IP is regional or specific to a particular Availability Domain. + + * `REGION`: The public IP exists within a region and can be assigned to a private IP + in any Availability Domain in the region. Reserved public IPs have `scope` = `REGION`. + + * `AVAILABILITY_DOMAIN`: The public IP exists within the Availability Domain of the private IP + it's assigned to, which is specified by the `availabilityDomain` property of the public IP object. + Ephemeral public IPs have `scope` = `AVAILABILITY_DOMAIN`. + + Allowed values are: "REGION", "AVAILABILITY_DOMAIN" + + :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 availability_domain: (optional) + The name of the Availability Domain. + + Example: `Uocm:PHX-AD-1` + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "availability_domain" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_public_ips got unknown kwargs: {!r}".format(extra_kwargs)) + + scope_allowed_values = ["REGION", "AVAILABILITY_DOMAIN"] + if scope not in scope_allowed_values: + raise ValueError( + "Invalid value for `scope`, must be one of {0}".format(scope_allowed_values) + ) + + query_params = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "scope": scope, + "availabilityDomain": kwargs.get("availability_domain", missing), + "compartmentId": compartment_id + } + 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[PublicIp]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[PublicIp]") + def list_route_tables(self, compartment_id, vcn_id, **kwargs): """ ListRouteTables @@ -5997,7 +6402,7 @@ def update_private_ip(self, private_ip_id, update_private_ip_details, **kwargs): :param str private_ip_id: (required) - The private IP's OCID. + The OCID of the private IP. :param UpdatePrivateIpDetails update_private_ip_details: (required) Private IP details. @@ -6058,6 +6463,114 @@ def update_private_ip(self, private_ip_id, update_private_ip_details, **kwargs): body=update_private_ip_details, response_type="PrivateIp") + def update_public_ip(self, public_ip_id, update_public_ip_details, **kwargs): + """ + UpdatePublicIp + Updates the specified public IP. You must specify the object's OCID. Use this operation if you want to: + + * Assign a reserved public IP in your pool to a private IP. + * Move a reserved public IP to a different private IP. + * Unassign a reserved public IP from a private IP (which returns it to your pool + of reserved public IPs). + * Change the display name for a public IP (either ephemeral or reserved). + + Assigning, moving, and unassigning a reserved public IP are asynchronous + operations. Poll the public IP's `lifecycleState` to determine if the operation + succeeded. + + **Note:** When moving a reserved public IP, the target private IP + must not already have a public IP with `lifecycleState` = ASSIGNING or ASSIGNED. If it + does, an error is returned. Also, the initial unassignment from the original + private IP always succeeds, but the assignment to the target private IP is asynchronous and + could fail silently (for example, if the target private IP is deleted or has a different public IP + assigned to it in the interim). If that occurs, the public IP remains unassigned and its + `lifecycleState` switches to AVAILABLE (it is not reassigned to its original private IP). + You must poll the public IP's `lifecycleState` to determine if the move succeeded. + + Regarding ephemeral public IPs: + + * If you want to assign an ephemeral public IP to a primary private IP, use + :func:`create_public_ip`. + * You can't move an ephemeral public IP to a different private IP. + * If you want to unassign an ephemeral public IP from its private IP, use + :func:`delete_public_ip`, which + unassigns and deletes the ephemeral public IP. + + **Note:** If a public IP (either ephemeral or reserved) is assigned to a secondary private + IP (see :class:`PrivateIp`), and you move that secondary + private IP to another VNIC, the public IP moves with it. + + **Note:** There's a limit to the number of :class:`PublicIp` + a VNIC or instance can have. If you try to move a reserved public IP + to a VNIC or instance that has already reached its public IP limit, an error is + returned. For information about the public IP limits, see + `Public IP Addresses`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingpublicIPs.htm + + + :param str public_ip_id: (required) + The OCID of the public IP. + + :param UpdatePublicIpDetails update_public_ip_details: (required) + Public IP details. + + :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.core.models.PublicIp` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/publicIps/{publicIpId}" + 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_public_ip got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "publicIpId": public_ip_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_public_ip_details, + response_type="PublicIp") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_public_ip_details, + response_type="PublicIp") + def update_route_table(self, rt_id, update_route_table_details, **kwargs): """ UpdateRouteTable diff --git a/src/oci/database/database_client.py b/src/oci/database/database_client.py index e45b2a3903..61a7a03e6b 100644 --- a/src/oci/database/database_client.py +++ b/src/oci/database/database_client.py @@ -1880,7 +1880,7 @@ def list_db_system_shapes(self, availability_domain, compartment_id, **kwargs): def list_db_systems(self, compartment_id, **kwargs): """ ListDbSystems - Gets a list of the DB Systems in the specified compartment. + Gets a list of the DB Systems in the specified compartment. You can specify a backupId to list only the DB Systems that support creating a database using this backup in this compartment. :param str compartment_id: (required) @@ -1894,6 +1894,9 @@ def list_db_systems(self, compartment_id, **kwargs): :param str page: (optional) The pagination token to continue listing from. + :param str backup_id: (optional) + The OCID of the backup. Specify a backupId to list only the DB Systems that support creating a database using this backup in this compartment. + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.database.models.DbSystemSummary` :rtype: :class:`~oci.response.Response` """ @@ -1904,7 +1907,8 @@ def list_db_systems(self, compartment_id, **kwargs): expected_kwargs = [ "retry_strategy", "limit", - "page" + "page", + "backup_id" ] extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] if extra_kwargs: @@ -1914,7 +1918,8 @@ def list_db_systems(self, compartment_id, **kwargs): query_params = { "compartmentId": compartment_id, "limit": kwargs.get("limit", missing), - "page": kwargs.get("page", missing) + "page": kwargs.get("page", missing), + "backupId": kwargs.get("backup_id", missing) } query_params = {k: v for (k, v) in six.iteritems(query_params) if v is not missing} diff --git a/src/oci/dns/__init__.py b/src/oci/dns/__init__.py new file mode 100644 index 0000000000..3ce6342836 --- /dev/null +++ b/src/oci/dns/__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 .dns_client import DnsClient +from . import models + +__all__ = ["DnsClient", "models"] diff --git a/src/oci/dns/dns_client.py b/src/oci/dns/dns_client.py new file mode 100644 index 0000000000..e270eca861 --- /dev/null +++ b/src/oci/dns/dns_client.py @@ -0,0 +1,1634 @@ +# 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 dns_type_mapping +missing = Sentinel("Missing") + + +class DnsClient(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("dns", config, signer, dns_type_mapping) + + def create_zone(self, create_zone_details, **kwargs): + """ + Creates a new zone in the specified compartment. The `compartmentId` + query parameter is required if the `Content-Type` header for the + request is `text/dns`. + + + :param CreateZoneDetails create_zone_details: (required) + Details for creating a new zone. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.Zone` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_zone got unknown kwargs: {!r}".format(extra_kwargs)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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, + body=create_zone_details, + response_type="Zone") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + body=create_zone_details, + response_type="Zone") + + def delete_domain_records(self, zone_name_or_id, domain, **kwargs): + """ + Deletes all records at the specified zone and domain. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_domain_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + + def delete_rr_set(self, zone_name_or_id, domain, rtype, **kwargs): + """ + Deletes all records in the specified RRSet. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str rtype: (required) + The type of the target RRSet within the target zone. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}/{rtype}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_rr_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain, + "rtype": rtype + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + + def delete_zone(self, zone_name_or_id, **kwargs): + """ + Deletes the specified zone. A `204` response indicates that zone has been + successfully deleted. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_zone got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params) + + def get_domain_records(self, zone_name_or_id, domain, **kwargs): + """ + Gets a list of all records at the specified zone and domain. + The results are sorted by `rtype` in alphabetical order by default. You + can optionally filter and/or sort the results using the listed parameters. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str if_none_match: (optional) + The `If-None-Match` header field makes the request method conditional on + the absence of any current representation of the target resource, when + the field-value is `*`, or having a selected representation with an + entity-tag that does not match any of those listed in the field-value. + + :param str if_modified_since: (optional) + The `If-Modified-Since` header field makes a GET or HEAD request method + conditional on the selected representation's modification date being more + recent than the date provided in the field-value. Transfer of the + selected representation's data is avoided if that data has not changed. + + :param int limit: (optional) + The maximum number of items to return in a page of the collection. + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str zone_version: (optional) + The version of the zone for which data is requested. + + :param str rtype: (optional) + Search by record type. + Will match any record whose `type`__ (case-insensitive) equals the provided value. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + :param str sort_by: (optional) + The field by which to sort records. + + Allowed values are: "rtype", "ttl" + + :param str sort_order: (optional) + The order to sort the resources. + + Allowed values are: "ASC", "DESC" + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_none_match", + "if_modified_since", + "limit", + "page", + "zone_version", + "rtype", + "sort_by", + "sort_order", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_domain_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain + } + + 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)) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["rtype", "ttl"] + 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 = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "zoneVersion": kwargs.get("zone_version", missing), + "rtype": kwargs.get("rtype", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing), + "compartmentId": kwargs.get("compartment_id", 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-None-Match": kwargs.get("if_none_match", missing), + "If-Modified-Since": kwargs.get("if_modified_since", 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, + query_params=query_params, + header_params=header_params, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="RecordCollection") + + def get_rr_set(self, zone_name_or_id, domain, rtype, **kwargs): + """ + Gets a list of all records in the specified RRSet. The results are + sorted by `recordHash` by default. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str rtype: (required) + The type of the target RRSet within the target zone. + + :param str if_none_match: (optional) + The `If-None-Match` header field makes the request method conditional on + the absence of any current representation of the target resource, when + the field-value is `*`, or having a selected representation with an + entity-tag that does not match any of those listed in the field-value. + + :param str if_modified_since: (optional) + The `If-Modified-Since` header field makes a GET or HEAD request method + conditional on the selected representation's modification date being more + recent than the date provided in the field-value. Transfer of the + selected representation's data is avoided if that data has not changed. + + :param int limit: (optional) + The maximum number of items to return in a page of the collection. + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str zone_version: (optional) + The version of the zone for which data is requested. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RRSet` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}/{rtype}" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_none_match", + "if_modified_since", + "limit", + "page", + "zone_version", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_rr_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain, + "rtype": rtype + } + + 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)) + + query_params = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "zoneVersion": kwargs.get("zone_version", missing), + "compartmentId": kwargs.get("compartment_id", 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-None-Match": kwargs.get("if_none_match", missing), + "If-Modified-Since": kwargs.get("if_modified_since", 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, + query_params=query_params, + header_params=header_params, + response_type="RRSet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="RRSet") + + def get_zone(self, zone_name_or_id, **kwargs): + """ + Gets information about the specified zone, including its creation date, + zone type, and serial. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str if_none_match: (optional) + The `If-None-Match` header field makes the request method conditional on + the absence of any current representation of the target resource, when + the field-value is `*`, or having a selected representation with an + entity-tag that does not match any of those listed in the field-value. + + :param str if_modified_since: (optional) + The `If-Modified-Since` header field makes a GET or HEAD request method + conditional on the selected representation's modification date being more + recent than the date provided in the field-value. Transfer of the + selected representation's data is avoided if that data has not changed. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.Zone` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_none_match", + "if_modified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_zone got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-None-Match": kwargs.get("if_none_match", missing), + "If-Modified-Since": kwargs.get("if_modified_since", 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, + query_params=query_params, + header_params=header_params, + response_type="Zone") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="Zone") + + def get_zone_records(self, zone_name_or_id, **kwargs): + """ + Gets all records in the specified zone. The results are + sorted by `domain` in alphabetical order by default. For more + information about records, please see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str if_none_match: (optional) + The `If-None-Match` header field makes the request method conditional on + the absence of any current representation of the target resource, when + the field-value is `*`, or having a selected representation with an + entity-tag that does not match any of those listed in the field-value. + + :param str if_modified_since: (optional) + The `If-Modified-Since` header field makes a GET or HEAD request method + conditional on the selected representation's modification date being more + recent than the date provided in the field-value. Transfer of the + selected representation's data is avoided if that data has not changed. + + :param int limit: (optional) + The maximum number of items to return in a page of the collection. + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str zone_version: (optional) + The version of the zone for which data is requested. + + :param str domain: (optional) + Search by domain. + Will match any record whose domain (case-insensitive) equals the provided value. + + :param str domain_contains: (optional) + Search by domain. + Will match any record whose domain (case-insensitive) contains the provided value. + + :param str rtype: (optional) + Search by record type. + Will match any record whose `type`__ (case-insensitive) equals the provided value. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + :param str sort_by: (optional) + The field by which to sort records. + + Allowed values are: "domain", "rtype", "ttl" + + :param str sort_order: (optional) + The order to sort the resources. + + Allowed values are: "ASC", "DESC" + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_none_match", + "if_modified_since", + "limit", + "page", + "zone_version", + "domain", + "domain_contains", + "rtype", + "sort_by", + "sort_order", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_zone_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["domain", "rtype", "ttl"] + 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 = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "zoneVersion": kwargs.get("zone_version", missing), + "domain": kwargs.get("domain", missing), + "domainContains": kwargs.get("domain_contains", missing), + "rtype": kwargs.get("rtype", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing), + "compartmentId": kwargs.get("compartment_id", 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-None-Match": kwargs.get("if_none_match", missing), + "If-Modified-Since": kwargs.get("if_modified_since", 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, + query_params=query_params, + header_params=header_params, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + response_type="RecordCollection") + + def list_zones(self, compartment_id, **kwargs): + """ + Gets a list of all zones in the specified compartment. The collection + can be filtered by name, time created, and zone type. + + + :param str compartment_id: (required) + The OCID of the compartment the resource belongs to. + + :param int limit: (optional) + The maximum number of items to return in a page of the collection. + + :param str page: (optional) + The value of the `opc-next-page` response header from the previous \"List\" call. + + :param str name: (optional) + A case-sensitive filter for zone names. + Will match any zone with a name that equals the provided value. + + :param str name_contains: (optional) + Search by zone name. + Will match any zone whose name (case-insensitive) contains the provided value. + + :param str zone_type: (optional) + Search by zone type, `PRIMARY` or `SECONDARY`. + Will match any zone whose type equals the provided value. + + Allowed values are: "PRIMARY", "SECONDARY" + + :param datetime time_created_greater_than_or_equal_to: (optional) + An `RFC 3339`__ timestamp that states + all returned resources were created on or after the indicated time. + + __ https://www.ietf.org/rfc/rfc3339.txt + + :param datetime time_created_less_than: (optional) + An `RFC 3339`__ timestamp that states + all returned resources were created before the indicated time. + + __ https://www.ietf.org/rfc/rfc3339.txt + + :param str sort_by: (optional) + The field by which to sort zones. + + Allowed values are: "name", "zoneType", "timeCreated" + + :param str sort_order: (optional) + The order to sort the resources. + + Allowed values are: "ASC", "DESC" + + :param str lifecycle_state: (optional) + The state of a resource. + + Allowed values are: "ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED" + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.dns.models.ZoneSummary` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "limit", + "page", + "name", + "name_contains", + "zone_type", + "time_created_greater_than_or_equal_to", + "time_created_less_than", + "sort_by", + "sort_order", + "lifecycle_state" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_zones got unknown kwargs: {!r}".format(extra_kwargs)) + + if 'zone_type' in kwargs: + zone_type_allowed_values = ["PRIMARY", "SECONDARY"] + if kwargs['zone_type'] not in zone_type_allowed_values: + raise ValueError( + "Invalid value for `zone_type`, must be one of {0}".format(zone_type_allowed_values) + ) + + if 'sort_by' in kwargs: + sort_by_allowed_values = ["name", "zoneType", "timeCreated"] + 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) + ) + + if 'lifecycle_state' in kwargs: + lifecycle_state_allowed_values = ["ACTIVE", "CREATING", "DELETED", "DELETING", "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) + ) + + query_params = { + "limit": kwargs.get("limit", missing), + "page": kwargs.get("page", missing), + "compartmentId": compartment_id, + "name": kwargs.get("name", missing), + "nameContains": kwargs.get("name_contains", missing), + "zoneType": kwargs.get("zone_type", missing), + "timeCreatedGreaterThanOrEqualTo": kwargs.get("time_created_greater_than_or_equal_to", missing), + "timeCreatedLessThan": kwargs.get("time_created_less_than", missing), + "sortBy": kwargs.get("sort_by", missing), + "sortOrder": kwargs.get("sort_order", missing), + "lifecycleState": kwargs.get("lifecycle_state", 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[ZoneSummary]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + query_params=query_params, + header_params=header_params, + response_type="list[ZoneSummary]") + + def patch_domain_records(self, zone_name_or_id, domain, patch_domain_records_details, **kwargs): + """ + Replaces records in the specified zone at a domain. You can update one record or all records for the specified zone depending on the changes provided in the request body. You can also add or remove records using this function. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param PatchDomainRecordsDetails patch_domain_records_details: (required) + Operations describing how to modify the collection of records. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}" + method = "PATCH" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "patch_domain_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=patch_domain_records_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=patch_domain_records_details, + response_type="RecordCollection") + + def patch_rr_set(self, zone_name_or_id, domain, rtype, patch_rr_set_details, **kwargs): + """ + Updates records in the specified RRSet. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str rtype: (required) + The type of the target RRSet within the target zone. + + :param PatchRRSetDetails patch_rr_set_details: (required) + Operations describing how to modify the collection of records. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}/{rtype}" + method = "PATCH" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "patch_rr_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain, + "rtype": rtype + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=patch_rr_set_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=patch_rr_set_details, + response_type="RecordCollection") + + def patch_zone_records(self, zone_name_or_id, patch_zone_records_details, **kwargs): + """ + Updates a collection of records in the specified zone. You can update + one record or all records for the specified zone depending on the + changes provided in the request body. You can also add or remove records + using this function. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param PatchZoneRecordsDetails patch_zone_records_details: (required) + The operations describing how to modify the collection of records. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records" + method = "PATCH" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "patch_zone_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=patch_zone_records_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=patch_zone_records_details, + response_type="RecordCollection") + + def update_domain_records(self, zone_name_or_id, domain, update_domain_records_details, **kwargs): + """ + Replaces records in the specified zone at a domain with the records + specified in the request body. If a specified record does not exist, + it will be created. If the record exists, then it will be updated to + represent the record in the body of the request. If a record in the zone + does not exist in the request body, the record will be removed from the + zone. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param UpdateDomainRecordsDetails update_domain_records_details: (required) + A full list of records for the domain. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_domain_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=update_domain_records_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=update_domain_records_details, + response_type="RecordCollection") + + def update_rr_set(self, zone_name_or_id, domain, rtype, update_rr_set_details, **kwargs): + """ + Replaces records in the specified RRSet. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param str domain: (required) + The target fully-qualified domain name (FQDN) within the target zone. + + :param str rtype: (required) + The type of the target RRSet within the target zone. + + :param UpdateRRSetDetails update_rr_set_details: (required) + A full list of records for the RRSet. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records/{domain}/{rtype}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_rr_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_id, + "domain": domain, + "rtype": rtype + } + + 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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=update_rr_set_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=update_rr_set_details, + response_type="RecordCollection") + + def update_zone(self, zone_name_or_id, update_zone_details, **kwargs): + """ + Updates the specified secondary zone with your new external master + server information. For more information about secondary zone, see + `Manage DNS Service Zone`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/DNS/Tasks/managingdnszones.htm + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param UpdateZoneDetails update_zone_details: (required) + New data for the zone. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.Zone` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_zone got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=update_zone_details, + response_type="Zone") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=update_zone_details, + response_type="Zone") + + def update_zone_records(self, zone_name_or_id, update_zone_records_details, **kwargs): + """ + Replaces records in the specified zone with the records specified in the + request body. If a specified record does not exist, it will be created. + If the record exists, then it will be updated to represent the record in + the body of the request. If a record in the zone does not exist in the + request body, the record will be removed from the zone. + + + :param str zone_name_or_id: (required) + The name or OCID of the target zone. + + :param UpdateZoneRecordsDetails update_zone_records_details: (required) + A full list of records for the zone. + + :param str if_match: (optional) + The `If-Match` header field makes the request method conditional on the + existence of at least one current representation of the target resource, + when the field-value is `*`, or having a current representation of the + target resource that has an entity-tag matching a member of the list of + entity-tags provided in the field-value. + + :param str if_unmodified_since: (optional) + The `If-Unmodified-Since` header field makes the request method + conditional on the selected representation's last modification date being + earlier than or equal to the date provided in the field-value. This + field accomplishes the same purpose as If-Match for cases where the user + agent does not have an entity-tag for the representation. + + :param str compartment_id: (optional) + The OCID of the compartment the resource belongs to. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.dns.models.RecordCollection` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/zones/{zoneNameOrId}/records" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "if_match", + "if_unmodified_since", + "compartment_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_zone_records got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "zoneNameOrId": zone_name_or_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)) + + query_params = { + "compartmentId": kwargs.get("compartment_id", 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-Match": kwargs.get("if_match", missing), + "If-Unmodified-Since": kwargs.get("if_unmodified_since", 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, + query_params=query_params, + header_params=header_params, + body=update_zone_records_details, + response_type="RecordCollection") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + query_params=query_params, + header_params=header_params, + body=update_zone_records_details, + response_type="RecordCollection") diff --git a/src/oci/dns/models/__init__.py b/src/oci/dns/models/__init__.py new file mode 100644 index 0000000000..10c4740974 --- /dev/null +++ b/src/oci/dns/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_zone_details import CreateZoneDetails +from .external_master import ExternalMaster +from .patch_domain_records_details import PatchDomainRecordsDetails +from .patch_rr_set_details import PatchRRSetDetails +from .patch_zone_records_details import PatchZoneRecordsDetails +from .rr_set import RRSet +from .record import Record +from .record_collection import RecordCollection +from .record_details import RecordDetails +from .record_operation import RecordOperation +from .tsig import TSIG +from .update_domain_records_details import UpdateDomainRecordsDetails +from .update_rr_set_details import UpdateRRSetDetails +from .update_zone_details import UpdateZoneDetails +from .update_zone_records_details import UpdateZoneRecordsDetails +from .zone import Zone +from .zone_summary import ZoneSummary + +# Maps type names to classes for dns services. +dns_type_mapping = { + "CreateZoneDetails": CreateZoneDetails, + "ExternalMaster": ExternalMaster, + "PatchDomainRecordsDetails": PatchDomainRecordsDetails, + "PatchRRSetDetails": PatchRRSetDetails, + "PatchZoneRecordsDetails": PatchZoneRecordsDetails, + "RRSet": RRSet, + "Record": Record, + "RecordCollection": RecordCollection, + "RecordDetails": RecordDetails, + "RecordOperation": RecordOperation, + "TSIG": TSIG, + "UpdateDomainRecordsDetails": UpdateDomainRecordsDetails, + "UpdateRRSetDetails": UpdateRRSetDetails, + "UpdateZoneDetails": UpdateZoneDetails, + "UpdateZoneRecordsDetails": UpdateZoneRecordsDetails, + "Zone": Zone, + "ZoneSummary": ZoneSummary +} diff --git a/src/oci/dns/models/create_zone_details.py b/src/oci/dns/models/create_zone_details.py new file mode 100644 index 0000000000..5290b4b35f --- /dev/null +++ b/src/oci/dns/models/create_zone_details.py @@ -0,0 +1,168 @@ +# 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 CreateZoneDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreateZoneDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this CreateZoneDetails. + :type name: str + + :param zone_type: + The value to assign to the zone_type property of this CreateZoneDetails. + Allowed values for this property are: "PRIMARY", "SECONDARY" + :type zone_type: str + + :param compartment_id: + The value to assign to the compartment_id property of this CreateZoneDetails. + :type compartment_id: str + + :param external_masters: + The value to assign to the external_masters property of this CreateZoneDetails. + :type external_masters: list[ExternalMaster] + + """ + self.swagger_types = { + 'name': 'str', + 'zone_type': 'str', + 'compartment_id': 'str', + 'external_masters': 'list[ExternalMaster]' + } + + self.attribute_map = { + 'name': 'name', + 'zone_type': 'zoneType', + 'compartment_id': 'compartmentId', + 'external_masters': 'externalMasters' + } + + self._name = None + self._zone_type = None + self._compartment_id = None + self._external_masters = None + + @property + def name(self): + """ + **[Required]** Gets the name of this CreateZoneDetails. + The name of the zone. + + + :return: The name of this CreateZoneDetails. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this CreateZoneDetails. + The name of the zone. + + + :param name: The name of this CreateZoneDetails. + :type: str + """ + self._name = name + + @property + def zone_type(self): + """ + **[Required]** Gets the zone_type of this CreateZoneDetails. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + Allowed values for this property are: "PRIMARY", "SECONDARY" + + + :return: The zone_type of this CreateZoneDetails. + :rtype: str + """ + return self._zone_type + + @zone_type.setter + def zone_type(self, zone_type): + """ + Sets the zone_type of this CreateZoneDetails. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + + :param zone_type: The zone_type of this CreateZoneDetails. + :type: str + """ + allowed_values = ["PRIMARY", "SECONDARY"] + if not value_allowed_none_or_none_sentinel(zone_type, allowed_values): + raise ValueError( + "Invalid value for `zone_type`, must be None or one of {0}" + .format(allowed_values) + ) + self._zone_type = zone_type + + @property + def compartment_id(self): + """ + **[Required]** Gets the compartment_id of this CreateZoneDetails. + The OCID of the compartment containing the zone. + + + :return: The compartment_id of this CreateZoneDetails. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this CreateZoneDetails. + The OCID of the compartment containing the zone. + + + :param compartment_id: The compartment_id of this CreateZoneDetails. + :type: str + """ + self._compartment_id = compartment_id + + @property + def external_masters(self): + """ + Gets the external_masters of this CreateZoneDetails. + External master servers for the zone. + + + :return: The external_masters of this CreateZoneDetails. + :rtype: list[ExternalMaster] + """ + return self._external_masters + + @external_masters.setter + def external_masters(self, external_masters): + """ + Sets the external_masters of this CreateZoneDetails. + External master servers for the zone. + + + :param external_masters: The external_masters of this CreateZoneDetails. + :type: list[ExternalMaster] + """ + self._external_masters = external_masters + + 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/dns/models/external_master.py b/src/oci/dns/models/external_master.py new file mode 100644 index 0000000000..60baf0ab5a --- /dev/null +++ b/src/oci/dns/models/external_master.py @@ -0,0 +1,124 @@ +# 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 ExternalMaster(object): + + def __init__(self, **kwargs): + """ + Initializes a new ExternalMaster object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param address: + The value to assign to the address property of this ExternalMaster. + :type address: str + + :param port: + The value to assign to the port property of this ExternalMaster. + :type port: int + + :param tsig: + The value to assign to the tsig property of this ExternalMaster. + :type tsig: TSIG + + """ + self.swagger_types = { + 'address': 'str', + 'port': 'int', + 'tsig': 'TSIG' + } + + self.attribute_map = { + 'address': 'address', + 'port': 'port', + 'tsig': 'tsig' + } + + self._address = None + self._port = None + self._tsig = None + + @property + def address(self): + """ + **[Required]** Gets the address of this ExternalMaster. + The server's IP address (IPv4 or IPv6). + + + :return: The address of this ExternalMaster. + :rtype: str + """ + return self._address + + @address.setter + def address(self, address): + """ + Sets the address of this ExternalMaster. + The server's IP address (IPv4 or IPv6). + + + :param address: The address of this ExternalMaster. + :type: str + """ + self._address = address + + @property + def port(self): + """ + Gets the port of this ExternalMaster. + The server's port. + + + :return: The port of this ExternalMaster. + :rtype: int + """ + return self._port + + @port.setter + def port(self, port): + """ + Sets the port of this ExternalMaster. + The server's port. + + + :param port: The port of this ExternalMaster. + :type: int + """ + self._port = port + + @property + def tsig(self): + """ + Gets the tsig of this ExternalMaster. + + :return: The tsig of this ExternalMaster. + :rtype: TSIG + """ + return self._tsig + + @tsig.setter + def tsig(self, tsig): + """ + Sets the tsig of this ExternalMaster. + + :param tsig: The tsig of this ExternalMaster. + :type: TSIG + """ + self._tsig = tsig + + 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/dns/models/patch_domain_records_details.py b/src/oci/dns/models/patch_domain_records_details.py new file mode 100644 index 0000000000..6b5eee4d05 --- /dev/null +++ b/src/oci/dns/models/patch_domain_records_details.py @@ -0,0 +1,62 @@ +# 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 PatchDomainRecordsDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new PatchDomainRecordsDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this PatchDomainRecordsDetails. + :type items: list[RecordOperation] + + """ + self.swagger_types = { + 'items': 'list[RecordOperation]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this PatchDomainRecordsDetails. + + :return: The items of this PatchDomainRecordsDetails. + :rtype: list[RecordOperation] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this PatchDomainRecordsDetails. + + :param items: The items of this PatchDomainRecordsDetails. + :type: list[RecordOperation] + """ + self._items = items + + 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/dns/models/patch_rr_set_details.py b/src/oci/dns/models/patch_rr_set_details.py new file mode 100644 index 0000000000..fee7f14d19 --- /dev/null +++ b/src/oci/dns/models/patch_rr_set_details.py @@ -0,0 +1,62 @@ +# 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 PatchRRSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new PatchRRSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this PatchRRSetDetails. + :type items: list[RecordOperation] + + """ + self.swagger_types = { + 'items': 'list[RecordOperation]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this PatchRRSetDetails. + + :return: The items of this PatchRRSetDetails. + :rtype: list[RecordOperation] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this PatchRRSetDetails. + + :param items: The items of this PatchRRSetDetails. + :type: list[RecordOperation] + """ + self._items = items + + 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/dns/models/patch_zone_records_details.py b/src/oci/dns/models/patch_zone_records_details.py new file mode 100644 index 0000000000..316db46405 --- /dev/null +++ b/src/oci/dns/models/patch_zone_records_details.py @@ -0,0 +1,62 @@ +# 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 PatchZoneRecordsDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new PatchZoneRecordsDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this PatchZoneRecordsDetails. + :type items: list[RecordOperation] + + """ + self.swagger_types = { + 'items': 'list[RecordOperation]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this PatchZoneRecordsDetails. + + :return: The items of this PatchZoneRecordsDetails. + :rtype: list[RecordOperation] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this PatchZoneRecordsDetails. + + :param items: The items of this PatchZoneRecordsDetails. + :type: list[RecordOperation] + """ + self._items = items + + 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/dns/models/record.py b/src/oci/dns/models/record.py new file mode 100644 index 0000000000..b751bd7ec0 --- /dev/null +++ b/src/oci/dns/models/record.py @@ -0,0 +1,264 @@ +# 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 Record(object): + + def __init__(self, **kwargs): + """ + Initializes a new Record object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param domain: + The value to assign to the domain property of this Record. + :type domain: str + + :param record_hash: + The value to assign to the record_hash property of this Record. + :type record_hash: str + + :param is_protected: + The value to assign to the is_protected property of this Record. + :type is_protected: bool + + :param rdata: + The value to assign to the rdata property of this Record. + :type rdata: str + + :param rrset_version: + The value to assign to the rrset_version property of this Record. + :type rrset_version: str + + :param rtype: + The value to assign to the rtype property of this Record. + :type rtype: str + + :param ttl: + The value to assign to the ttl property of this Record. + :type ttl: int + + """ + self.swagger_types = { + 'domain': 'str', + 'record_hash': 'str', + 'is_protected': 'bool', + 'rdata': 'str', + 'rrset_version': 'str', + 'rtype': 'str', + 'ttl': 'int' + } + + self.attribute_map = { + 'domain': 'domain', + 'record_hash': 'recordHash', + 'is_protected': 'isProtected', + 'rdata': 'rdata', + 'rrset_version': 'rrsetVersion', + 'rtype': 'rtype', + 'ttl': 'ttl' + } + + self._domain = None + self._record_hash = None + self._is_protected = None + self._rdata = None + self._rrset_version = None + self._rtype = None + self._ttl = None + + @property + def domain(self): + """ + Gets the domain of this Record. + The fully qualified domain name where the record can be located. + + + :return: The domain of this Record. + :rtype: str + """ + return self._domain + + @domain.setter + def domain(self, domain): + """ + Sets the domain of this Record. + The fully qualified domain name where the record can be located. + + + :param domain: The domain of this Record. + :type: str + """ + self._domain = domain + + @property + def record_hash(self): + """ + Gets the record_hash of this Record. + A unique identifier for the record within its zone. + + + :return: The record_hash of this Record. + :rtype: str + """ + return self._record_hash + + @record_hash.setter + def record_hash(self, record_hash): + """ + Sets the record_hash of this Record. + A unique identifier for the record within its zone. + + + :param record_hash: The record_hash of this Record. + :type: str + """ + self._record_hash = record_hash + + @property + def is_protected(self): + """ + Gets the is_protected of this Record. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :return: The is_protected of this Record. + :rtype: bool + """ + return self._is_protected + + @is_protected.setter + def is_protected(self, is_protected): + """ + Sets the is_protected of this Record. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :param is_protected: The is_protected of this Record. + :type: bool + """ + self._is_protected = is_protected + + @property + def rdata(self): + """ + Gets the rdata of this Record. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :return: The rdata of this Record. + :rtype: str + """ + return self._rdata + + @rdata.setter + def rdata(self, rdata): + """ + Sets the rdata of this Record. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :param rdata: The rdata of this Record. + :type: str + """ + self._rdata = rdata + + @property + def rrset_version(self): + """ + Gets the rrset_version of this Record. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :return: The rrset_version of this Record. + :rtype: str + """ + return self._rrset_version + + @rrset_version.setter + def rrset_version(self, rrset_version): + """ + Sets the rrset_version of this Record. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :param rrset_version: The rrset_version of this Record. + :type: str + """ + self._rrset_version = rrset_version + + @property + def rtype(self): + """ + Gets the rtype of this Record. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :return: The rtype of this Record. + :rtype: str + """ + return self._rtype + + @rtype.setter + def rtype(self, rtype): + """ + Sets the rtype of this Record. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :param rtype: The rtype of this Record. + :type: str + """ + self._rtype = rtype + + @property + def ttl(self): + """ + Gets the ttl of this Record. + The Time To Live for the record, in seconds. + + + :return: The ttl of this Record. + :rtype: int + """ + return self._ttl + + @ttl.setter + def ttl(self, ttl): + """ + Sets the ttl of this Record. + The Time To Live for the record, in seconds. + + + :param ttl: The ttl of this Record. + :type: int + """ + self._ttl = ttl + + 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/dns/models/record_collection.py b/src/oci/dns/models/record_collection.py new file mode 100644 index 0000000000..f6d0b160dd --- /dev/null +++ b/src/oci/dns/models/record_collection.py @@ -0,0 +1,62 @@ +# 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 RecordCollection(object): + + def __init__(self, **kwargs): + """ + Initializes a new RecordCollection object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this RecordCollection. + :type items: list[Record] + + """ + self.swagger_types = { + 'items': 'list[Record]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this RecordCollection. + + :return: The items of this RecordCollection. + :rtype: list[Record] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this RecordCollection. + + :param items: The items of this RecordCollection. + :type: list[Record] + """ + self._items = items + + 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/dns/models/record_details.py b/src/oci/dns/models/record_details.py new file mode 100644 index 0000000000..9cf826d1c0 --- /dev/null +++ b/src/oci/dns/models/record_details.py @@ -0,0 +1,264 @@ +# 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 RecordDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new RecordDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param domain: + The value to assign to the domain property of this RecordDetails. + :type domain: str + + :param record_hash: + The value to assign to the record_hash property of this RecordDetails. + :type record_hash: str + + :param is_protected: + The value to assign to the is_protected property of this RecordDetails. + :type is_protected: bool + + :param rdata: + The value to assign to the rdata property of this RecordDetails. + :type rdata: str + + :param rrset_version: + The value to assign to the rrset_version property of this RecordDetails. + :type rrset_version: str + + :param rtype: + The value to assign to the rtype property of this RecordDetails. + :type rtype: str + + :param ttl: + The value to assign to the ttl property of this RecordDetails. + :type ttl: int + + """ + self.swagger_types = { + 'domain': 'str', + 'record_hash': 'str', + 'is_protected': 'bool', + 'rdata': 'str', + 'rrset_version': 'str', + 'rtype': 'str', + 'ttl': 'int' + } + + self.attribute_map = { + 'domain': 'domain', + 'record_hash': 'recordHash', + 'is_protected': 'isProtected', + 'rdata': 'rdata', + 'rrset_version': 'rrsetVersion', + 'rtype': 'rtype', + 'ttl': 'ttl' + } + + self._domain = None + self._record_hash = None + self._is_protected = None + self._rdata = None + self._rrset_version = None + self._rtype = None + self._ttl = None + + @property + def domain(self): + """ + **[Required]** Gets the domain of this RecordDetails. + The fully qualified domain name where the record can be located. + + + :return: The domain of this RecordDetails. + :rtype: str + """ + return self._domain + + @domain.setter + def domain(self, domain): + """ + Sets the domain of this RecordDetails. + The fully qualified domain name where the record can be located. + + + :param domain: The domain of this RecordDetails. + :type: str + """ + self._domain = domain + + @property + def record_hash(self): + """ + Gets the record_hash of this RecordDetails. + A unique identifier for the record within its zone. + + + :return: The record_hash of this RecordDetails. + :rtype: str + """ + return self._record_hash + + @record_hash.setter + def record_hash(self, record_hash): + """ + Sets the record_hash of this RecordDetails. + A unique identifier for the record within its zone. + + + :param record_hash: The record_hash of this RecordDetails. + :type: str + """ + self._record_hash = record_hash + + @property + def is_protected(self): + """ + Gets the is_protected of this RecordDetails. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :return: The is_protected of this RecordDetails. + :rtype: bool + """ + return self._is_protected + + @is_protected.setter + def is_protected(self, is_protected): + """ + Sets the is_protected of this RecordDetails. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :param is_protected: The is_protected of this RecordDetails. + :type: bool + """ + self._is_protected = is_protected + + @property + def rdata(self): + """ + **[Required]** Gets the rdata of this RecordDetails. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :return: The rdata of this RecordDetails. + :rtype: str + """ + return self._rdata + + @rdata.setter + def rdata(self, rdata): + """ + Sets the rdata of this RecordDetails. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :param rdata: The rdata of this RecordDetails. + :type: str + """ + self._rdata = rdata + + @property + def rrset_version(self): + """ + Gets the rrset_version of this RecordDetails. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :return: The rrset_version of this RecordDetails. + :rtype: str + """ + return self._rrset_version + + @rrset_version.setter + def rrset_version(self, rrset_version): + """ + Sets the rrset_version of this RecordDetails. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :param rrset_version: The rrset_version of this RecordDetails. + :type: str + """ + self._rrset_version = rrset_version + + @property + def rtype(self): + """ + **[Required]** Gets the rtype of this RecordDetails. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :return: The rtype of this RecordDetails. + :rtype: str + """ + return self._rtype + + @rtype.setter + def rtype(self, rtype): + """ + Sets the rtype of this RecordDetails. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :param rtype: The rtype of this RecordDetails. + :type: str + """ + self._rtype = rtype + + @property + def ttl(self): + """ + **[Required]** Gets the ttl of this RecordDetails. + The Time To Live for the record, in seconds. + + + :return: The ttl of this RecordDetails. + :rtype: int + """ + return self._ttl + + @ttl.setter + def ttl(self, ttl): + """ + Sets the ttl of this RecordDetails. + The Time To Live for the record, in seconds. + + + :param ttl: The ttl of this RecordDetails. + :type: int + """ + self._ttl = ttl + + 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/dns/models/record_operation.py b/src/oci/dns/models/record_operation.py new file mode 100644 index 0000000000..9a73c18b0e --- /dev/null +++ b/src/oci/dns/models/record_operation.py @@ -0,0 +1,334 @@ +# 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 RecordOperation(object): + + def __init__(self, **kwargs): + """ + Initializes a new RecordOperation object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param domain: + The value to assign to the domain property of this RecordOperation. + :type domain: str + + :param record_hash: + The value to assign to the record_hash property of this RecordOperation. + :type record_hash: str + + :param is_protected: + The value to assign to the is_protected property of this RecordOperation. + :type is_protected: bool + + :param rdata: + The value to assign to the rdata property of this RecordOperation. + :type rdata: str + + :param rrset_version: + The value to assign to the rrset_version property of this RecordOperation. + :type rrset_version: str + + :param rtype: + The value to assign to the rtype property of this RecordOperation. + :type rtype: str + + :param ttl: + The value to assign to the ttl property of this RecordOperation. + :type ttl: int + + :param operation: + The value to assign to the operation property of this RecordOperation. + Allowed values for this property are: "REQUIRE", "PROHIBIT", "ADD", "REMOVE" + :type operation: str + + """ + self.swagger_types = { + 'domain': 'str', + 'record_hash': 'str', + 'is_protected': 'bool', + 'rdata': 'str', + 'rrset_version': 'str', + 'rtype': 'str', + 'ttl': 'int', + 'operation': 'str' + } + + self.attribute_map = { + 'domain': 'domain', + 'record_hash': 'recordHash', + 'is_protected': 'isProtected', + 'rdata': 'rdata', + 'rrset_version': 'rrsetVersion', + 'rtype': 'rtype', + 'ttl': 'ttl', + 'operation': 'operation' + } + + self._domain = None + self._record_hash = None + self._is_protected = None + self._rdata = None + self._rrset_version = None + self._rtype = None + self._ttl = None + self._operation = None + + @property + def domain(self): + """ + Gets the domain of this RecordOperation. + The fully qualified domain name where the record can be located. + + + :return: The domain of this RecordOperation. + :rtype: str + """ + return self._domain + + @domain.setter + def domain(self, domain): + """ + Sets the domain of this RecordOperation. + The fully qualified domain name where the record can be located. + + + :param domain: The domain of this RecordOperation. + :type: str + """ + self._domain = domain + + @property + def record_hash(self): + """ + Gets the record_hash of this RecordOperation. + A unique identifier for the record within its zone. + + + :return: The record_hash of this RecordOperation. + :rtype: str + """ + return self._record_hash + + @record_hash.setter + def record_hash(self, record_hash): + """ + Sets the record_hash of this RecordOperation. + A unique identifier for the record within its zone. + + + :param record_hash: The record_hash of this RecordOperation. + :type: str + """ + self._record_hash = record_hash + + @property + def is_protected(self): + """ + Gets the is_protected of this RecordOperation. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :return: The is_protected of this RecordOperation. + :rtype: bool + """ + return self._is_protected + + @is_protected.setter + def is_protected(self, is_protected): + """ + Sets the is_protected of this RecordOperation. + A Boolean flag indicating whether or not parts of the record + are unable to be explicitly managed. + + + :param is_protected: The is_protected of this RecordOperation. + :type: bool + """ + self._is_protected = is_protected + + @property + def rdata(self): + """ + Gets the rdata of this RecordOperation. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :return: The rdata of this RecordOperation. + :rtype: str + """ + return self._rdata + + @rdata.setter + def rdata(self, rdata): + """ + Sets the rdata of this RecordOperation. + The record's data, as whitespace-delimited tokens in + type-specific presentation format. + + + :param rdata: The rdata of this RecordOperation. + :type: str + """ + self._rdata = rdata + + @property + def rrset_version(self): + """ + Gets the rrset_version of this RecordOperation. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :return: The rrset_version of this RecordOperation. + :rtype: str + """ + return self._rrset_version + + @rrset_version.setter + def rrset_version(self, rrset_version): + """ + Sets the rrset_version of this RecordOperation. + The latest version of the record's zone in which its RRSet differs + from the preceding version. + + + :param rrset_version: The rrset_version of this RecordOperation. + :type: str + """ + self._rrset_version = rrset_version + + @property + def rtype(self): + """ + Gets the rtype of this RecordOperation. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :return: The rtype of this RecordOperation. + :rtype: str + """ + return self._rtype + + @rtype.setter + def rtype(self, rtype): + """ + Sets the rtype of this RecordOperation. + The canonical name for the record's type, such as A or CNAME. For more + information, see `Resource Record (RR) TYPEs`__. + + __ https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4 + + + :param rtype: The rtype of this RecordOperation. + :type: str + """ + self._rtype = rtype + + @property + def ttl(self): + """ + Gets the ttl of this RecordOperation. + The Time To Live for the record, in seconds. + + + :return: The ttl of this RecordOperation. + :rtype: int + """ + return self._ttl + + @ttl.setter + def ttl(self, ttl): + """ + Sets the ttl of this RecordOperation. + The Time To Live for the record, in seconds. + + + :param ttl: The ttl of this RecordOperation. + :type: int + """ + self._ttl = ttl + + @property + def operation(self): + """ + Gets the operation of this RecordOperation. + A description of how a record relates to a PATCH operation. + + - `REQUIRE` indicates a precondition that record data **must** already exist. + - `PROHIBIT` indicates a precondition that record data **must not** already exist. + - `ADD` indicates that record data **must** exist after successful application. + - `REMOVE` indicates that record data **must not** exist after successful application. + + **Note:** `ADD` and `REMOVE` operations can succeed even if + they require no changes when applied, such as when the described + records are already present or absent. + + **Note:** `ADD` and `REMOVE` operations can describe changes for + more than one record. + + **Example:** `{ \"domain\": \"www.example.com\", \"rtype\": \"AAAA\", \"ttl\": 60 }` + specifies a new TTL for every record in the www.example.com AAAA RRSet. + + Allowed values for this property are: "REQUIRE", "PROHIBIT", "ADD", "REMOVE" + + + :return: The operation of this RecordOperation. + :rtype: str + """ + return self._operation + + @operation.setter + def operation(self, operation): + """ + Sets the operation of this RecordOperation. + A description of how a record relates to a PATCH operation. + + - `REQUIRE` indicates a precondition that record data **must** already exist. + - `PROHIBIT` indicates a precondition that record data **must not** already exist. + - `ADD` indicates that record data **must** exist after successful application. + - `REMOVE` indicates that record data **must not** exist after successful application. + + **Note:** `ADD` and `REMOVE` operations can succeed even if + they require no changes when applied, such as when the described + records are already present or absent. + + **Note:** `ADD` and `REMOVE` operations can describe changes for + more than one record. + + **Example:** `{ \"domain\": \"www.example.com\", \"rtype\": \"AAAA\", \"ttl\": 60 }` + specifies a new TTL for every record in the www.example.com AAAA RRSet. + + + :param operation: The operation of this RecordOperation. + :type: str + """ + allowed_values = ["REQUIRE", "PROHIBIT", "ADD", "REMOVE"] + if not value_allowed_none_or_none_sentinel(operation, allowed_values): + raise ValueError( + "Invalid value for `operation`, must be None or one of {0}" + .format(allowed_values) + ) + self._operation = operation + + 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/dns/models/rr_set.py b/src/oci/dns/models/rr_set.py new file mode 100644 index 0000000000..6a821fc947 --- /dev/null +++ b/src/oci/dns/models/rr_set.py @@ -0,0 +1,62 @@ +# 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 RRSet(object): + + def __init__(self, **kwargs): + """ + Initializes a new RRSet object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this RRSet. + :type items: list[Record] + + """ + self.swagger_types = { + 'items': 'list[Record]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this RRSet. + + :return: The items of this RRSet. + :rtype: list[Record] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this RRSet. + + :param items: The items of this RRSet. + :type: list[Record] + """ + self._items = items + + 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/dns/models/tsig.py b/src/oci/dns/models/tsig.py new file mode 100644 index 0000000000..fccaf1cbf2 --- /dev/null +++ b/src/oci/dns/models/tsig.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 TSIG(object): + + def __init__(self, **kwargs): + """ + Initializes a new TSIG object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this TSIG. + :type name: str + + :param secret: + The value to assign to the secret property of this TSIG. + :type secret: str + + :param algorithm: + The value to assign to the algorithm property of this TSIG. + :type algorithm: str + + """ + self.swagger_types = { + 'name': 'str', + 'secret': 'str', + 'algorithm': 'str' + } + + self.attribute_map = { + 'name': 'name', + 'secret': 'secret', + 'algorithm': 'algorithm' + } + + self._name = None + self._secret = None + self._algorithm = None + + @property + def name(self): + """ + **[Required]** Gets the name of this TSIG. + A domain name identifying the key for a given pair of hosts. + + + :return: The name of this TSIG. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this TSIG. + A domain name identifying the key for a given pair of hosts. + + + :param name: The name of this TSIG. + :type: str + """ + self._name = name + + @property + def secret(self): + """ + **[Required]** Gets the secret of this TSIG. + A base64 string encoding the binary shared secret. + + + :return: The secret of this TSIG. + :rtype: str + """ + return self._secret + + @secret.setter + def secret(self, secret): + """ + Sets the secret of this TSIG. + A base64 string encoding the binary shared secret. + + + :param secret: The secret of this TSIG. + :type: str + """ + self._secret = secret + + @property + def algorithm(self): + """ + **[Required]** Gets the algorithm of this TSIG. + TSIG Algorithms are encoded as domain names, but most consist of only one + non-empty label, which is not required to be explicitly absolute. For a + full list of TSIG algorithms, see `Secret Key Transaction Authentication for DNS (TSIG) Algorithm Names`__ + + __ http://www.iana.org/assignments/tsig-algorithm-names/tsig-algorithm-names.xhtml#tsig-algorithm-names-1 + + + :return: The algorithm of this TSIG. + :rtype: str + """ + return self._algorithm + + @algorithm.setter + def algorithm(self, algorithm): + """ + Sets the algorithm of this TSIG. + TSIG Algorithms are encoded as domain names, but most consist of only one + non-empty label, which is not required to be explicitly absolute. For a + full list of TSIG algorithms, see `Secret Key Transaction Authentication for DNS (TSIG) Algorithm Names`__ + + __ http://www.iana.org/assignments/tsig-algorithm-names/tsig-algorithm-names.xhtml#tsig-algorithm-names-1 + + + :param algorithm: The algorithm of this TSIG. + :type: str + """ + self._algorithm = algorithm + + 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/dns/models/update_domain_records_details.py b/src/oci/dns/models/update_domain_records_details.py new file mode 100644 index 0000000000..4081d1e88b --- /dev/null +++ b/src/oci/dns/models/update_domain_records_details.py @@ -0,0 +1,62 @@ +# 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 UpdateDomainRecordsDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateDomainRecordsDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this UpdateDomainRecordsDetails. + :type items: list[RecordDetails] + + """ + self.swagger_types = { + 'items': 'list[RecordDetails]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this UpdateDomainRecordsDetails. + + :return: The items of this UpdateDomainRecordsDetails. + :rtype: list[RecordDetails] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this UpdateDomainRecordsDetails. + + :param items: The items of this UpdateDomainRecordsDetails. + :type: list[RecordDetails] + """ + self._items = items + + 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/dns/models/update_rr_set_details.py b/src/oci/dns/models/update_rr_set_details.py new file mode 100644 index 0000000000..e8ef7c3dc3 --- /dev/null +++ b/src/oci/dns/models/update_rr_set_details.py @@ -0,0 +1,62 @@ +# 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 UpdateRRSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateRRSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this UpdateRRSetDetails. + :type items: list[RecordDetails] + + """ + self.swagger_types = { + 'items': 'list[RecordDetails]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this UpdateRRSetDetails. + + :return: The items of this UpdateRRSetDetails. + :rtype: list[RecordDetails] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this UpdateRRSetDetails. + + :param items: The items of this UpdateRRSetDetails. + :type: list[RecordDetails] + """ + self._items = items + + 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/dns/models/update_zone_details.py b/src/oci/dns/models/update_zone_details.py new file mode 100644 index 0000000000..66cd09e257 --- /dev/null +++ b/src/oci/dns/models/update_zone_details.py @@ -0,0 +1,66 @@ +# 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 UpdateZoneDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateZoneDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param external_masters: + The value to assign to the external_masters property of this UpdateZoneDetails. + :type external_masters: list[ExternalMaster] + + """ + self.swagger_types = { + 'external_masters': 'list[ExternalMaster]' + } + + self.attribute_map = { + 'external_masters': 'externalMasters' + } + + self._external_masters = None + + @property + def external_masters(self): + """ + Gets the external_masters of this UpdateZoneDetails. + External master servers for the zone. + + + :return: The external_masters of this UpdateZoneDetails. + :rtype: list[ExternalMaster] + """ + return self._external_masters + + @external_masters.setter + def external_masters(self, external_masters): + """ + Sets the external_masters of this UpdateZoneDetails. + External master servers for the zone. + + + :param external_masters: The external_masters of this UpdateZoneDetails. + :type: list[ExternalMaster] + """ + self._external_masters = external_masters + + 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/dns/models/update_zone_records_details.py b/src/oci/dns/models/update_zone_records_details.py new file mode 100644 index 0000000000..80bbbfd30e --- /dev/null +++ b/src/oci/dns/models/update_zone_records_details.py @@ -0,0 +1,62 @@ +# 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 UpdateZoneRecordsDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdateZoneRecordsDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param items: + The value to assign to the items property of this UpdateZoneRecordsDetails. + :type items: list[RecordDetails] + + """ + self.swagger_types = { + 'items': 'list[RecordDetails]' + } + + self.attribute_map = { + 'items': 'items' + } + + self._items = None + + @property + def items(self): + """ + Gets the items of this UpdateZoneRecordsDetails. + + :return: The items of this UpdateZoneRecordsDetails. + :rtype: list[RecordDetails] + """ + return self._items + + @items.setter + def items(self, items): + """ + Sets the items of this UpdateZoneRecordsDetails. + + :param items: The items of this UpdateZoneRecordsDetails. + :type: list[RecordDetails] + """ + self._items = items + + 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/dns/models/zone.py b/src/oci/dns/models/zone.py new file mode 100644 index 0000000000..8b235b0ce4 --- /dev/null +++ b/src/oci/dns/models/zone.py @@ -0,0 +1,371 @@ +# 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 Zone(object): + + def __init__(self, **kwargs): + """ + Initializes a new Zone object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this Zone. + :type name: str + + :param zone_type: + The value to assign to the zone_type property of this Zone. + Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type zone_type: str + + :param compartment_id: + The value to assign to the compartment_id property of this Zone. + :type compartment_id: str + + :param external_masters: + The value to assign to the external_masters property of this Zone. + :type external_masters: list[ExternalMaster] + + :param self_uri: + The value to assign to the self_uri property of this Zone. + :type self_uri: str + + :param id: + The value to assign to the id property of this Zone. + :type id: str + + :param time_created: + The value to assign to the time_created property of this Zone. + :type time_created: datetime + + :param version: + The value to assign to the version property of this Zone. + :type version: str + + :param serial: + The value to assign to the serial property of this Zone. + :type serial: int + + :param lifecycle_state: + The value to assign to the lifecycle_state property of this Zone. + Allowed values for this property are: "ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type lifecycle_state: str + + """ + self.swagger_types = { + 'name': 'str', + 'zone_type': 'str', + 'compartment_id': 'str', + 'external_masters': 'list[ExternalMaster]', + 'self_uri': 'str', + 'id': 'str', + 'time_created': 'datetime', + 'version': 'str', + 'serial': 'int', + 'lifecycle_state': 'str' + } + + self.attribute_map = { + 'name': 'name', + 'zone_type': 'zoneType', + 'compartment_id': 'compartmentId', + 'external_masters': 'externalMasters', + 'self_uri': 'self', + 'id': 'id', + 'time_created': 'timeCreated', + 'version': 'version', + 'serial': 'serial', + 'lifecycle_state': 'lifecycleState' + } + + self._name = None + self._zone_type = None + self._compartment_id = None + self._external_masters = None + self._self_uri = None + self._id = None + self._time_created = None + self._version = None + self._serial = None + self._lifecycle_state = None + + @property + def name(self): + """ + Gets the name of this Zone. + The name of the zone. + + + :return: The name of this Zone. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this Zone. + The name of the zone. + + + :param name: The name of this Zone. + :type: str + """ + self._name = name + + @property + def zone_type(self): + """ + Gets the zone_type of this Zone. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The zone_type of this Zone. + :rtype: str + """ + return self._zone_type + + @zone_type.setter + def zone_type(self, zone_type): + """ + Sets the zone_type of this Zone. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + + :param zone_type: The zone_type of this Zone. + :type: str + """ + allowed_values = ["PRIMARY", "SECONDARY"] + if not value_allowed_none_or_none_sentinel(zone_type, allowed_values): + zone_type = 'UNKNOWN_ENUM_VALUE' + self._zone_type = zone_type + + @property + def compartment_id(self): + """ + Gets the compartment_id of this Zone. + The OCID of the compartment containing the zone. + + + :return: The compartment_id of this Zone. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this Zone. + The OCID of the compartment containing the zone. + + + :param compartment_id: The compartment_id of this Zone. + :type: str + """ + self._compartment_id = compartment_id + + @property + def external_masters(self): + """ + Gets the external_masters of this Zone. + External master servers for the zone. + + + :return: The external_masters of this Zone. + :rtype: list[ExternalMaster] + """ + return self._external_masters + + @external_masters.setter + def external_masters(self, external_masters): + """ + Sets the external_masters of this Zone. + External master servers for the zone. + + + :param external_masters: The external_masters of this Zone. + :type: list[ExternalMaster] + """ + self._external_masters = external_masters + + @property + def self_uri(self): + """ + Gets the self_uri of this Zone. + The canonical absolute URL of the resource. + + + :return: The self_uri of this Zone. + :rtype: str + """ + return self._self_uri + + @self_uri.setter + def self_uri(self, self_uri): + """ + Sets the self_uri of this Zone. + The canonical absolute URL of the resource. + + + :param self_uri: The self_uri of this Zone. + :type: str + """ + self._self_uri = self_uri + + @property + def id(self): + """ + Gets the id of this Zone. + The OCID of the zone. + + + :return: The id of this Zone. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this Zone. + The OCID of the zone. + + + :param id: The id of this Zone. + :type: str + """ + self._id = id + + @property + def time_created(self): + """ + Gets the time_created of this Zone. + The date and time the image was created in \"YYYY-MM-ddThh:mmZ\" format + with a Z offset, as defined by RFC 3339. + + **Example:** `2016-07-22T17:23:59:60Z` + + + :return: The time_created of this Zone. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this Zone. + The date and time the image was created in \"YYYY-MM-ddThh:mmZ\" format + with a Z offset, as defined by RFC 3339. + + **Example:** `2016-07-22T17:23:59:60Z` + + + :param time_created: The time_created of this Zone. + :type: datetime + """ + self._time_created = time_created + + @property + def version(self): + """ + Gets the version of this Zone. + Version is the never-repeating, totally-orderable, version of the + zone, from which the serial field of the zone's SOA record is + derived. + + + :return: The version of this Zone. + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """ + Sets the version of this Zone. + Version is the never-repeating, totally-orderable, version of the + zone, from which the serial field of the zone's SOA record is + derived. + + + :param version: The version of this Zone. + :type: str + """ + self._version = version + + @property + def serial(self): + """ + Gets the serial of this Zone. + The current serial of the zone. As seen in the zone's SOA record. + + + :return: The serial of this Zone. + :rtype: int + """ + return self._serial + + @serial.setter + def serial(self, serial): + """ + Sets the serial of this Zone. + The current serial of the zone. As seen in the zone's SOA record. + + + :param serial: The serial of this Zone. + :type: int + """ + self._serial = serial + + @property + def lifecycle_state(self): + """ + Gets the lifecycle_state of this Zone. + The current state of the zone resource. + + Allowed values for this property are: "ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The lifecycle_state of this Zone. + :rtype: str + """ + return self._lifecycle_state + + @lifecycle_state.setter + def lifecycle_state(self, lifecycle_state): + """ + Sets the lifecycle_state of this Zone. + The current state of the zone resource. + + + :param lifecycle_state: The lifecycle_state of this Zone. + :type: str + """ + allowed_values = ["ACTIVE", "CREATING", "DELETED", "DELETING", "FAILED"] + if not value_allowed_none_or_none_sentinel(lifecycle_state, allowed_values): + lifecycle_state = 'UNKNOWN_ENUM_VALUE' + self._lifecycle_state = lifecycle_state + + 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/dns/models/zone_summary.py b/src/oci/dns/models/zone_summary.py new file mode 100644 index 0000000000..f78dc9dc48 --- /dev/null +++ b/src/oci/dns/models/zone_summary.py @@ -0,0 +1,301 @@ +# 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 ZoneSummary(object): + + def __init__(self, **kwargs): + """ + Initializes a new ZoneSummary object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this ZoneSummary. + :type name: str + + :param zone_type: + The value to assign to the zone_type property of this ZoneSummary. + Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type zone_type: str + + :param compartment_id: + The value to assign to the compartment_id property of this ZoneSummary. + :type compartment_id: str + + :param self_uri: + The value to assign to the self_uri property of this ZoneSummary. + :type self_uri: str + + :param id: + The value to assign to the id property of this ZoneSummary. + :type id: str + + :param time_created: + The value to assign to the time_created property of this ZoneSummary. + :type time_created: datetime + + :param version: + The value to assign to the version property of this ZoneSummary. + :type version: str + + :param serial: + The value to assign to the serial property of this ZoneSummary. + :type serial: int + + """ + self.swagger_types = { + 'name': 'str', + 'zone_type': 'str', + 'compartment_id': 'str', + 'self_uri': 'str', + 'id': 'str', + 'time_created': 'datetime', + 'version': 'str', + 'serial': 'int' + } + + self.attribute_map = { + 'name': 'name', + 'zone_type': 'zoneType', + 'compartment_id': 'compartmentId', + 'self_uri': 'self', + 'id': 'id', + 'time_created': 'timeCreated', + 'version': 'version', + 'serial': 'serial' + } + + self._name = None + self._zone_type = None + self._compartment_id = None + self._self_uri = None + self._id = None + self._time_created = None + self._version = None + self._serial = None + + @property + def name(self): + """ + Gets the name of this ZoneSummary. + The name of the zone. + + + :return: The name of this ZoneSummary. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this ZoneSummary. + The name of the zone. + + + :param name: The name of this ZoneSummary. + :type: str + """ + self._name = name + + @property + def zone_type(self): + """ + Gets the zone_type of this ZoneSummary. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + Allowed values for this property are: "PRIMARY", "SECONDARY", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The zone_type of this ZoneSummary. + :rtype: str + """ + return self._zone_type + + @zone_type.setter + def zone_type(self, zone_type): + """ + Sets the zone_type of this ZoneSummary. + The type of the zone. Must be either `PRIMARY` or `SECONDARY`. + + + :param zone_type: The zone_type of this ZoneSummary. + :type: str + """ + allowed_values = ["PRIMARY", "SECONDARY"] + if not value_allowed_none_or_none_sentinel(zone_type, allowed_values): + zone_type = 'UNKNOWN_ENUM_VALUE' + self._zone_type = zone_type + + @property + def compartment_id(self): + """ + Gets the compartment_id of this ZoneSummary. + The OCID of the compartment containing the zone. + + + :return: The compartment_id of this ZoneSummary. + :rtype: str + """ + return self._compartment_id + + @compartment_id.setter + def compartment_id(self, compartment_id): + """ + Sets the compartment_id of this ZoneSummary. + The OCID of the compartment containing the zone. + + + :param compartment_id: The compartment_id of this ZoneSummary. + :type: str + """ + self._compartment_id = compartment_id + + @property + def self_uri(self): + """ + Gets the self_uri of this ZoneSummary. + The canonical absolute URL of the resource. + + + :return: The self_uri of this ZoneSummary. + :rtype: str + """ + return self._self_uri + + @self_uri.setter + def self_uri(self, self_uri): + """ + Sets the self_uri of this ZoneSummary. + The canonical absolute URL of the resource. + + + :param self_uri: The self_uri of this ZoneSummary. + :type: str + """ + self._self_uri = self_uri + + @property + def id(self): + """ + Gets the id of this ZoneSummary. + The OCID of the zone. + + + :return: The id of this ZoneSummary. + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """ + Sets the id of this ZoneSummary. + The OCID of the zone. + + + :param id: The id of this ZoneSummary. + :type: str + """ + self._id = id + + @property + def time_created(self): + """ + Gets the time_created of this ZoneSummary. + The date and time the image was created in \"YYYY-MM-ddThh:mmZ\" format + with a Z offset, as defined by RFC 3339. + + **Example:** `2016-07-22T17:23:59:60Z` + + + :return: The time_created of this ZoneSummary. + :rtype: datetime + """ + return self._time_created + + @time_created.setter + def time_created(self, time_created): + """ + Sets the time_created of this ZoneSummary. + The date and time the image was created in \"YYYY-MM-ddThh:mmZ\" format + with a Z offset, as defined by RFC 3339. + + **Example:** `2016-07-22T17:23:59:60Z` + + + :param time_created: The time_created of this ZoneSummary. + :type: datetime + """ + self._time_created = time_created + + @property + def version(self): + """ + Gets the version of this ZoneSummary. + Version is the never-repeating, totally-orderable, version of the + zone, from which the serial field of the zone's SOA record is + derived. + + + :return: The version of this ZoneSummary. + :rtype: str + """ + return self._version + + @version.setter + def version(self, version): + """ + Sets the version of this ZoneSummary. + Version is the never-repeating, totally-orderable, version of the + zone, from which the serial field of the zone's SOA record is + derived. + + + :param version: The version of this ZoneSummary. + :type: str + """ + self._version = version + + @property + def serial(self): + """ + Gets the serial of this ZoneSummary. + The current serial of the zone. As seen in the zone's SOA record. + + + :return: The serial of this ZoneSummary. + :rtype: int + """ + return self._serial + + @serial.setter + def serial(self, serial): + """ + Sets the serial of this ZoneSummary. + The current serial of the zone. As seen in the zone's SOA record. + + + :param serial: The serial of this ZoneSummary. + :type: int + """ + self._serial = serial + + 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/identity/identity_client.py b/src/oci/identity/identity_client.py index ca3c1b265c..530192d604 100644 --- a/src/oci/identity/identity_client.py +++ b/src/oci/identity/identity_client.py @@ -3137,6 +3137,7 @@ def list_user_group_memberships(self, compartment_id, **kwargs): - Similarly, you can limit the results to just the memberships for a given group by specifying a `groupId`. - You can set both the `userId` and `groupId` to determine if the specified user is in the specified group. If the answer is no, the response is an empty list. + - Although`userId` and `groupId` are not indvidually required, you must set one of them. __ https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#five diff --git a/src/oci/identity/models/create_dynamic_group_details.py b/src/oci/identity/models/create_dynamic_group_details.py index 8ff4ed8579..311c7ce7fa 100644 --- a/src/oci/identity/models/create_dynamic_group_details.py +++ b/src/oci/identity/models/create_dynamic_group_details.py @@ -104,7 +104,10 @@ def name(self, name): def matching_rule(self): """ **[Required]** Gets the matching_rule of this CreateDynamicGroupDetails. - The matching rule to dynamically match an instance certificate to this dynamic group + The matching rule to dynamically match an instance certificate to this dynamic group. + For rule syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :return: The matching_rule of this CreateDynamicGroupDetails. @@ -116,7 +119,10 @@ def matching_rule(self): def matching_rule(self, matching_rule): """ Sets the matching_rule of this CreateDynamicGroupDetails. - The matching rule to dynamically match an instance certificate to this dynamic group + The matching rule to dynamically match an instance certificate to this dynamic group. + For rule syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :param matching_rule: The matching_rule of this CreateDynamicGroupDetails. diff --git a/src/oci/identity/models/dynamic_group.py b/src/oci/identity/models/dynamic_group.py index ae6341b746..93f8a99636 100644 --- a/src/oci/identity/models/dynamic_group.py +++ b/src/oci/identity/models/dynamic_group.py @@ -183,6 +183,9 @@ def matching_rule(self): """ **[Required]** Gets the matching_rule of this DynamicGroup. A rule string that defines which instance certificates will be matched. + For syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :return: The matching_rule of this DynamicGroup. @@ -195,6 +198,9 @@ def matching_rule(self, matching_rule): """ Sets the matching_rule of this DynamicGroup. A rule string that defines which instance certificates will be matched. + For syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :param matching_rule: The matching_rule of this DynamicGroup. diff --git a/src/oci/identity/models/update_dynamic_group_details.py b/src/oci/identity/models/update_dynamic_group_details.py index 92ac4ab1cf..f23aa0c111 100644 --- a/src/oci/identity/models/update_dynamic_group_details.py +++ b/src/oci/identity/models/update_dynamic_group_details.py @@ -64,7 +64,10 @@ def description(self, description): def matching_rule(self): """ Gets the matching_rule of this UpdateDynamicGroupDetails. - The matching rule to dynamically match an instance certificate to this dynamic group + The matching rule to dynamically match an instance certificate to this dynamic group. + For rule syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :return: The matching_rule of this UpdateDynamicGroupDetails. @@ -76,7 +79,10 @@ def matching_rule(self): def matching_rule(self, matching_rule): """ Sets the matching_rule of this UpdateDynamicGroupDetails. - The matching rule to dynamically match an instance certificate to this dynamic group + The matching rule to dynamically match an instance certificate to this dynamic group. + For rule syntax, see `Managing Dynamic Groups`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Tasks/managingdynamicgroups.htm :param matching_rule: The matching_rule of this UpdateDynamicGroupDetails. diff --git a/src/oci/load_balancer/load_balancer_client.py b/src/oci/load_balancer/load_balancer_client.py index 34889e4687..4efc2bfb0a 100644 --- a/src/oci/load_balancer/load_balancer_client.py +++ b/src/oci/load_balancer/load_balancer_client.py @@ -442,6 +442,87 @@ def create_load_balancer(self, create_load_balancer_details, **kwargs): header_params=header_params, body=create_load_balancer_details) + def create_path_route_set(self, create_path_route_set_details, load_balancer_id, **kwargs): + """ + CreatePathRouteSet + Adds a path route set to a load balancer. For more information, see + `Managing Request Routing`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingrequest.htm + + + :param CreatePathRouteSetDetails create_path_route_set_details: (required) + The details of the path route set to add. + + :param str load_balancer_id: (required) + The `OCID`__ of the load balancer to add the path route set to. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + + :param str opc_request_id: (optional) + The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + particular request, please provide the request ID. + + :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 (e.g., if a resource + has been deleted and purged from the system, then a retry of the original creation request + may be rejected). + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/loadBalancers/{loadBalancerId}/pathRouteSets" + method = "POST" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "create_path_route_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "loadBalancerId": load_balancer_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", + "opc-request-id": kwargs.get("opc_request_id", missing), + "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, + path_params=path_params, + header_params=header_params, + body=create_path_route_set_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=create_path_route_set_details) + def delete_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs): """ DeleteBackend @@ -784,6 +865,77 @@ def delete_load_balancer(self, load_balancer_id, **kwargs): path_params=path_params, header_params=header_params) + def delete_path_route_set(self, load_balancer_id, path_route_set_name, **kwargs): + """ + DeletePathRouteSet + Deletes a path route set from the specified load balancer. + + To delete a path route rule from a path route set, use the + :func:`update_path_route_set` operation. + + + :param str load_balancer_id: (required) + The `OCID`__ of the load balancer associated with the path route set to delete. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + + :param str path_route_set_name: (required) + The name of the path route set to delete. + + Example: `path-route-set-001` + + :param str opc_request_id: (optional) + The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + particular request, please provide the request ID. + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/loadBalancers/{loadBalancerId}/pathRouteSets/{pathRouteSetName}" + method = "DELETE" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "delete_path_route_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "loadBalancerId": load_balancer_id, + "pathRouteSetName": path_route_set_name + } + + 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", + "opc-request-id": kwargs.get("opc_request_id", 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_backend(self, load_balancer_id, backend_set_name, backend_name, **kwargs): """ GetBackend @@ -1274,6 +1426,76 @@ def get_load_balancer_health(self, load_balancer_id, **kwargs): header_params=header_params, response_type="LoadBalancerHealth") + def get_path_route_set(self, load_balancer_id, path_route_set_name, **kwargs): + """ + GetPathRouteSet + Gets the specified path route set's configuration information. + + + :param str load_balancer_id: (required) + The `OCID`__ of the specified load balancer. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + + :param str path_route_set_name: (required) + The name of the path route set to retrieve. + + Example: `path-route-set-001` + + :param str opc_request_id: (optional) + The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + particular request, please provide the request ID. + + :return: A :class:`~oci.response.Response` object with data of type :class:`~oci.load_balancer.models.PathRouteSet` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/loadBalancers/{loadBalancerId}/pathRouteSets/{pathRouteSetName}" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "get_path_route_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "loadBalancerId": load_balancer_id, + "pathRouteSetName": path_route_set_name + } + + 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", + "opc-request-id": kwargs.get("opc_request_id", 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, + response_type="PathRouteSet") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="PathRouteSet") + def get_work_request(self, work_request_id, **kwargs): """ GetWorkRequest @@ -1737,6 +1959,71 @@ def list_load_balancers(self, compartment_id, **kwargs): header_params=header_params, response_type="list[LoadBalancer]") + def list_path_route_sets(self, load_balancer_id, **kwargs): + """ + ListPathRouteSets + Lists all path route sets associated with the specified load balancer. + + + :param str load_balancer_id: (required) + The `OCID`__ of the load balancer associated with the path route sets + to retrieve. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + + :param str opc_request_id: (optional) + The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + particular request, please provide the request ID. + + :return: A :class:`~oci.response.Response` object with data of type list of :class:`~oci.load_balancer.models.PathRouteSet` + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/loadBalancers/{loadBalancerId}/pathRouteSets" + method = "GET" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "list_path_route_sets got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "loadBalancerId": load_balancer_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", + "opc-request-id": kwargs.get("opc_request_id", 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, + response_type="list[PathRouteSet]") + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + response_type="list[PathRouteSet]") + def list_policies(self, compartment_id, **kwargs): """ ListPolicies @@ -2459,3 +2746,92 @@ def update_load_balancer(self, update_load_balancer_details, load_balancer_id, * path_params=path_params, header_params=header_params, body=update_load_balancer_details) + + def update_path_route_set(self, update_path_route_set_details, load_balancer_id, path_route_set_name, **kwargs): + """ + UpdatePathRouteSet + Overwrites an existing path route set on the specified load balancer. Use this operation to add, delete, or alter + path route rules in a path route set. + + To add a new path route rule to a path route set, the `pathRoutes` in the + :func:`update_path_route_set_details` object must include + both the new path route rule to add and the existing path route rules to retain. + + + :param UpdatePathRouteSetDetails update_path_route_set_details: (required) + The configuration details to update a path route set. + + :param str load_balancer_id: (required) + The `OCID`__ of the load balancer associated with the path route set to update. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/identifiers.htm + + :param str path_route_set_name: (required) + The name of the path route set to update. + + Example: `path-route-set-001` + + :param str opc_request_id: (optional) + The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + particular request, please provide the request ID. + + :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 (e.g., if a resource + has been deleted and purged from the system, then a retry of the original creation request + may be rejected). + + :return: A :class:`~oci.response.Response` object with data of type None + :rtype: :class:`~oci.response.Response` + """ + resource_path = "/loadBalancers/{loadBalancerId}/pathRouteSets/{pathRouteSetName}" + method = "PUT" + + # Don't accept unknown kwargs + expected_kwargs = [ + "retry_strategy", + "opc_request_id", + "opc_retry_token" + ] + extra_kwargs = [key for key in six.iterkeys(kwargs) if key not in expected_kwargs] + if extra_kwargs: + raise ValueError( + "update_path_route_set got unknown kwargs: {!r}".format(extra_kwargs)) + + path_params = { + "loadBalancerId": load_balancer_id, + "pathRouteSetName": path_route_set_name + } + + 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", + "opc-request-id": kwargs.get("opc_request_id", missing), + "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, + path_params=path_params, + header_params=header_params, + body=update_path_route_set_details) + else: + return self.base_client.call_api( + resource_path=resource_path, + method=method, + path_params=path_params, + header_params=header_params, + body=update_path_route_set_details) diff --git a/src/oci/load_balancer/models/__init__.py b/src/oci/load_balancer/models/__init__.py index dfb0879017..1d6002e0b1 100644 --- a/src/oci/load_balancer/models/__init__.py +++ b/src/oci/load_balancer/models/__init__.py @@ -17,6 +17,7 @@ from .create_certificate_details import CreateCertificateDetails from .create_listener_details import CreateListenerDetails from .create_load_balancer_details import CreateLoadBalancerDetails +from .create_path_route_set_details import CreatePathRouteSetDetails from .health_check_result import HealthCheckResult from .health_checker import HealthChecker from .health_checker_details import HealthCheckerDetails @@ -29,6 +30,10 @@ from .load_balancer_policy import LoadBalancerPolicy from .load_balancer_protocol import LoadBalancerProtocol from .load_balancer_shape import LoadBalancerShape +from .path_match_type import PathMatchType +from .path_route import PathRoute +from .path_route_set import PathRouteSet +from .path_route_set_details import PathRouteSetDetails from .ssl_configuration import SSLConfiguration from .ssl_configuration_details import SSLConfigurationDetails from .session_persistence_configuration_details import SessionPersistenceConfigurationDetails @@ -37,6 +42,7 @@ from .update_health_checker_details import UpdateHealthCheckerDetails from .update_listener_details import UpdateListenerDetails from .update_load_balancer_details import UpdateLoadBalancerDetails +from .update_path_route_set_details import UpdatePathRouteSetDetails from .work_request import WorkRequest from .work_request_error import WorkRequestError @@ -56,6 +62,7 @@ "CreateCertificateDetails": CreateCertificateDetails, "CreateListenerDetails": CreateListenerDetails, "CreateLoadBalancerDetails": CreateLoadBalancerDetails, + "CreatePathRouteSetDetails": CreatePathRouteSetDetails, "HealthCheckResult": HealthCheckResult, "HealthChecker": HealthChecker, "HealthCheckerDetails": HealthCheckerDetails, @@ -68,6 +75,10 @@ "LoadBalancerPolicy": LoadBalancerPolicy, "LoadBalancerProtocol": LoadBalancerProtocol, "LoadBalancerShape": LoadBalancerShape, + "PathMatchType": PathMatchType, + "PathRoute": PathRoute, + "PathRouteSet": PathRouteSet, + "PathRouteSetDetails": PathRouteSetDetails, "SSLConfiguration": SSLConfiguration, "SSLConfigurationDetails": SSLConfigurationDetails, "SessionPersistenceConfigurationDetails": SessionPersistenceConfigurationDetails, @@ -76,6 +87,7 @@ "UpdateHealthCheckerDetails": UpdateHealthCheckerDetails, "UpdateListenerDetails": UpdateListenerDetails, "UpdateLoadBalancerDetails": UpdateLoadBalancerDetails, + "UpdatePathRouteSetDetails": UpdatePathRouteSetDetails, "WorkRequest": WorkRequest, "WorkRequestError": WorkRequestError } diff --git a/src/oci/load_balancer/models/create_listener_details.py b/src/oci/load_balancer/models/create_listener_details.py index 722f98d37e..215611018b 100644 --- a/src/oci/load_balancer/models/create_listener_details.py +++ b/src/oci/load_balancer/models/create_listener_details.py @@ -26,6 +26,10 @@ def __init__(self, **kwargs): The value to assign to the name property of this CreateListenerDetails. :type name: str + :param path_route_set_name: + The value to assign to the path_route_set_name property of this CreateListenerDetails. + :type path_route_set_name: str + :param port: The value to assign to the port property of this CreateListenerDetails. :type port: int @@ -43,6 +47,7 @@ def __init__(self, **kwargs): 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'name': 'str', + 'path_route_set_name': 'str', 'port': 'int', 'protocol': 'str', 'ssl_configuration': 'SSLConfigurationDetails' @@ -52,6 +57,7 @@ def __init__(self, **kwargs): 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'name': 'name', + 'path_route_set_name': 'pathRouteSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' @@ -60,6 +66,7 @@ def __init__(self, **kwargs): self._connection_configuration = None self._default_backend_set_name = None self._name = None + self._path_route_set_name = None self._port = None self._protocol = None self._ssl_configuration = None @@ -142,6 +149,36 @@ def name(self, name): """ self._name = name + @property + def path_route_set_name(self): + """ + Gets the path_route_set_name of this CreateListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :return: The path_route_set_name of this CreateListenerDetails. + :rtype: str + """ + return self._path_route_set_name + + @path_route_set_name.setter + def path_route_set_name(self, path_route_set_name): + """ + Sets the path_route_set_name of this CreateListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :param path_route_set_name: The path_route_set_name of this CreateListenerDetails. + :type: str + """ + self._path_route_set_name = path_route_set_name + @property def port(self): """ diff --git a/src/oci/load_balancer/models/create_load_balancer_details.py b/src/oci/load_balancer/models/create_load_balancer_details.py index 0c0cfc35ac..ec9f19e0b3 100644 --- a/src/oci/load_balancer/models/create_load_balancer_details.py +++ b/src/oci/load_balancer/models/create_load_balancer_details.py @@ -38,6 +38,10 @@ def __init__(self, **kwargs): The value to assign to the listeners property of this CreateLoadBalancerDetails. :type listeners: dict(str, ListenerDetails) + :param path_route_sets: + The value to assign to the path_route_sets property of this CreateLoadBalancerDetails. + :type path_route_sets: dict(str, PathRouteSetDetails) + :param shape_name: The value to assign to the shape_name property of this CreateLoadBalancerDetails. :type shape_name: str @@ -54,6 +58,7 @@ def __init__(self, **kwargs): 'display_name': 'str', 'is_private': 'bool', 'listeners': 'dict(str, ListenerDetails)', + 'path_route_sets': 'dict(str, PathRouteSetDetails)', 'shape_name': 'str', 'subnet_ids': 'list[str]' } @@ -65,6 +70,7 @@ def __init__(self, **kwargs): 'display_name': 'displayName', 'is_private': 'isPrivate', 'listeners': 'listeners', + 'path_route_sets': 'pathRouteSets', 'shape_name': 'shapeName', 'subnet_ids': 'subnetIds' } @@ -75,6 +81,7 @@ def __init__(self, **kwargs): self._display_name = None self._is_private = None self._listeners = None + self._path_route_sets = None self._shape_name = None self._subnet_ids = None @@ -252,6 +259,26 @@ def listeners(self, listeners): """ self._listeners = listeners + @property + def path_route_sets(self): + """ + Gets the path_route_sets of this CreateLoadBalancerDetails. + + :return: The path_route_sets of this CreateLoadBalancerDetails. + :rtype: dict(str, PathRouteSetDetails) + """ + return self._path_route_sets + + @path_route_sets.setter + def path_route_sets(self, path_route_sets): + """ + Sets the path_route_sets of this CreateLoadBalancerDetails. + + :param path_route_sets: The path_route_sets of this CreateLoadBalancerDetails. + :type: dict(str, PathRouteSetDetails) + """ + self._path_route_sets = path_route_sets + @property def shape_name(self): """ diff --git a/src/oci/load_balancer/models/create_path_route_set_details.py b/src/oci/load_balancer/models/create_path_route_set_details.py new file mode 100644 index 0000000000..f78ab78edc --- /dev/null +++ b/src/oci/load_balancer/models/create_path_route_set_details.py @@ -0,0 +1,103 @@ +# 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 CreatePathRouteSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new CreatePathRouteSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this CreatePathRouteSetDetails. + :type name: str + + :param path_routes: + The value to assign to the path_routes property of this CreatePathRouteSetDetails. + :type path_routes: list[PathRoute] + + """ + self.swagger_types = { + 'name': 'str', + 'path_routes': 'list[PathRoute]' + } + + self.attribute_map = { + 'name': 'name', + 'path_routes': 'pathRoutes' + } + + self._name = None + self._path_routes = None + + @property + def name(self): + """ + **[Required]** Gets the name of this CreatePathRouteSetDetails. + The name for this set of path route rules. It must be unique and it cannot be changed. Avoid entering + confidential information. + + Example: `path-route-set-001` + + + :return: The name of this CreatePathRouteSetDetails. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this CreatePathRouteSetDetails. + The name for this set of path route rules. It must be unique and it cannot be changed. Avoid entering + confidential information. + + Example: `path-route-set-001` + + + :param name: The name of this CreatePathRouteSetDetails. + :type: str + """ + self._name = name + + @property + def path_routes(self): + """ + **[Required]** Gets the path_routes of this CreatePathRouteSetDetails. + The set of path route rules. + + + :return: The path_routes of this CreatePathRouteSetDetails. + :rtype: list[PathRoute] + """ + return self._path_routes + + @path_routes.setter + def path_routes(self, path_routes): + """ + Sets the path_routes of this CreatePathRouteSetDetails. + The set of path route rules. + + + :param path_routes: The path_routes of this CreatePathRouteSetDetails. + :type: list[PathRoute] + """ + self._path_routes = path_routes + + 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/load_balancer/models/listener.py b/src/oci/load_balancer/models/listener.py index a177c421ea..16c19c2611 100644 --- a/src/oci/load_balancer/models/listener.py +++ b/src/oci/load_balancer/models/listener.py @@ -26,6 +26,10 @@ def __init__(self, **kwargs): The value to assign to the name property of this Listener. :type name: str + :param path_route_set_name: + The value to assign to the path_route_set_name property of this Listener. + :type path_route_set_name: str + :param port: The value to assign to the port property of this Listener. :type port: int @@ -43,6 +47,7 @@ def __init__(self, **kwargs): 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', 'name': 'str', + 'path_route_set_name': 'str', 'port': 'int', 'protocol': 'str', 'ssl_configuration': 'SSLConfiguration' @@ -52,6 +57,7 @@ def __init__(self, **kwargs): 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', 'name': 'name', + 'path_route_set_name': 'pathRouteSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' @@ -60,6 +66,7 @@ def __init__(self, **kwargs): self._connection_configuration = None self._default_backend_set_name = None self._name = None + self._path_route_set_name = None self._port = None self._protocol = None self._ssl_configuration = None @@ -140,6 +147,36 @@ def name(self, name): """ self._name = name + @property + def path_route_set_name(self): + """ + Gets the path_route_set_name of this Listener. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :return: The path_route_set_name of this Listener. + :rtype: str + """ + return self._path_route_set_name + + @path_route_set_name.setter + def path_route_set_name(self, path_route_set_name): + """ + Sets the path_route_set_name of this Listener. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :param path_route_set_name: The path_route_set_name of this Listener. + :type: str + """ + self._path_route_set_name = path_route_set_name + @property def port(self): """ diff --git a/src/oci/load_balancer/models/listener_details.py b/src/oci/load_balancer/models/listener_details.py index 2788ad1254..677fe50ddf 100644 --- a/src/oci/load_balancer/models/listener_details.py +++ b/src/oci/load_balancer/models/listener_details.py @@ -22,6 +22,10 @@ def __init__(self, **kwargs): The value to assign to the default_backend_set_name property of this ListenerDetails. :type default_backend_set_name: str + :param path_route_set_name: + The value to assign to the path_route_set_name property of this ListenerDetails. + :type path_route_set_name: str + :param port: The value to assign to the port property of this ListenerDetails. :type port: int @@ -38,6 +42,7 @@ def __init__(self, **kwargs): self.swagger_types = { 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', + 'path_route_set_name': 'str', 'port': 'int', 'protocol': 'str', 'ssl_configuration': 'SSLConfigurationDetails' @@ -46,6 +51,7 @@ def __init__(self, **kwargs): self.attribute_map = { 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', + 'path_route_set_name': 'pathRouteSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' @@ -53,6 +59,7 @@ def __init__(self, **kwargs): self._connection_configuration = None self._default_backend_set_name = None + self._path_route_set_name = None self._port = None self._protocol = None self._ssl_configuration = None @@ -105,6 +112,36 @@ def default_backend_set_name(self, default_backend_set_name): """ self._default_backend_set_name = default_backend_set_name + @property + def path_route_set_name(self): + """ + Gets the path_route_set_name of this ListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :return: The path_route_set_name of this ListenerDetails. + :rtype: str + """ + return self._path_route_set_name + + @path_route_set_name.setter + def path_route_set_name(self, path_route_set_name): + """ + Sets the path_route_set_name of this ListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :param path_route_set_name: The path_route_set_name of this ListenerDetails. + :type: str + """ + self._path_route_set_name = path_route_set_name + @property def port(self): """ diff --git a/src/oci/load_balancer/models/load_balancer.py b/src/oci/load_balancer/models/load_balancer.py index d2c725f290..ddf0d678e9 100644 --- a/src/oci/load_balancer/models/load_balancer.py +++ b/src/oci/load_balancer/models/load_balancer.py @@ -52,6 +52,10 @@ def __init__(self, **kwargs): The value to assign to the listeners property of this LoadBalancer. :type listeners: dict(str, Listener) + :param path_route_sets: + The value to assign to the path_route_sets property of this LoadBalancer. + :type path_route_sets: dict(str, PathRouteSet) + :param shape_name: The value to assign to the shape_name property of this LoadBalancer. :type shape_name: str @@ -75,6 +79,7 @@ def __init__(self, **kwargs): 'is_private': 'bool', 'lifecycle_state': 'str', 'listeners': 'dict(str, Listener)', + 'path_route_sets': 'dict(str, PathRouteSet)', 'shape_name': 'str', 'subnet_ids': 'list[str]', 'time_created': 'datetime' @@ -90,6 +95,7 @@ def __init__(self, **kwargs): 'is_private': 'isPrivate', 'lifecycle_state': 'lifecycleState', 'listeners': 'listeners', + 'path_route_sets': 'pathRouteSets', 'shape_name': 'shapeName', 'subnet_ids': 'subnetIds', 'time_created': 'timeCreated' @@ -104,6 +110,7 @@ def __init__(self, **kwargs): self._is_private = None self._lifecycle_state = None self._listeners = None + self._path_route_sets = None self._shape_name = None self._subnet_ids = None self._time_created = None @@ -358,6 +365,26 @@ def listeners(self, listeners): """ self._listeners = listeners + @property + def path_route_sets(self): + """ + Gets the path_route_sets of this LoadBalancer. + + :return: The path_route_sets of this LoadBalancer. + :rtype: dict(str, PathRouteSet) + """ + return self._path_route_sets + + @path_route_sets.setter + def path_route_sets(self, path_route_sets): + """ + Sets the path_route_sets of this LoadBalancer. + + :param path_route_sets: The path_route_sets of this LoadBalancer. + :type: dict(str, PathRouteSet) + """ + self._path_route_sets = path_route_sets + @property def shape_name(self): """ diff --git a/src/oci/load_balancer/models/path_match_type.py b/src/oci/load_balancer/models/path_match_type.py new file mode 100644 index 0000000000..0b8a9fd409 --- /dev/null +++ b/src/oci/load_balancer/models/path_match_type.py @@ -0,0 +1,104 @@ +# 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 PathMatchType(object): + + def __init__(self, **kwargs): + """ + Initializes a new PathMatchType object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param match_type: + The value to assign to the match_type property of this PathMatchType. + Allowed values for this property are: "EXACT_MATCH", "FORCE_LONGEST_PREFIX_MATCH", "PREFIX_MATCH", "SUFFIX_MATCH", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + :type match_type: str + + """ + self.swagger_types = { + 'match_type': 'str' + } + + self.attribute_map = { + 'match_type': 'matchType' + } + + self._match_type = None + + @property + def match_type(self): + """ + **[Required]** Gets the match_type of this PathMatchType. + Specifies how the load balancing service compares a :func:`path_route` + object's `path` string against the incoming URI. + + * **EXACT_MATCH** - Looks for a `path` string that exactly matches the incoming URI path. + + * **FORCE_LONGEST_PREFIX_MATCH** - Looks for the `path` string with the best, longest match of the beginning + portion of the incoming URI path. + + * **PREFIX_MATCH** - Looks for a `path` string that matches the beginning portion of the incoming URI path. + + * **SUFFIX_MATCH** - Looks for a `path` string that matches the ending portion of the incoming URI path. + + For a full description of how the system handles `matchType` in a path route set containing multiple rules, see + `Managing Request Routing`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingrequest.htm + + Allowed values for this property are: "EXACT_MATCH", "FORCE_LONGEST_PREFIX_MATCH", "PREFIX_MATCH", "SUFFIX_MATCH", 'UNKNOWN_ENUM_VALUE'. + Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'. + + + :return: The match_type of this PathMatchType. + :rtype: str + """ + return self._match_type + + @match_type.setter + def match_type(self, match_type): + """ + Sets the match_type of this PathMatchType. + Specifies how the load balancing service compares a :func:`path_route` + object's `path` string against the incoming URI. + + * **EXACT_MATCH** - Looks for a `path` string that exactly matches the incoming URI path. + + * **FORCE_LONGEST_PREFIX_MATCH** - Looks for the `path` string with the best, longest match of the beginning + portion of the incoming URI path. + + * **PREFIX_MATCH** - Looks for a `path` string that matches the beginning portion of the incoming URI path. + + * **SUFFIX_MATCH** - Looks for a `path` string that matches the ending portion of the incoming URI path. + + For a full description of how the system handles `matchType` in a path route set containing multiple rules, see + `Managing Request Routing`__. + + __ https://docs.us-phoenix-1.oraclecloud.com/Content/Balance/Tasks/managingrequest.htm + + + :param match_type: The match_type of this PathMatchType. + :type: str + """ + allowed_values = ["EXACT_MATCH", "FORCE_LONGEST_PREFIX_MATCH", "PREFIX_MATCH", "SUFFIX_MATCH"] + if not value_allowed_none_or_none_sentinel(match_type, allowed_values): + match_type = 'UNKNOWN_ENUM_VALUE' + self._match_type = match_type + + 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/load_balancer/models/path_route.py b/src/oci/load_balancer/models/path_route.py new file mode 100644 index 0000000000..ee2e5b6732 --- /dev/null +++ b/src/oci/load_balancer/models/path_route.py @@ -0,0 +1,148 @@ +# 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 PathRoute(object): + + def __init__(self, **kwargs): + """ + Initializes a new PathRoute object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param backend_set_name: + The value to assign to the backend_set_name property of this PathRoute. + :type backend_set_name: str + + :param path: + The value to assign to the path property of this PathRoute. + :type path: str + + :param path_match_type: + The value to assign to the path_match_type property of this PathRoute. + :type path_match_type: PathMatchType + + """ + self.swagger_types = { + 'backend_set_name': 'str', + 'path': 'str', + 'path_match_type': 'PathMatchType' + } + + self.attribute_map = { + 'backend_set_name': 'backendSetName', + 'path': 'path', + 'path_match_type': 'pathMatchType' + } + + self._backend_set_name = None + self._path = None + self._path_match_type = None + + @property + def backend_set_name(self): + """ + **[Required]** Gets the backend_set_name of this PathRoute. + The name of the target backend set for requests where the incoming URI matches the specified path. + + Example: `My_backend_set` + + + :return: The backend_set_name of this PathRoute. + :rtype: str + """ + return self._backend_set_name + + @backend_set_name.setter + def backend_set_name(self, backend_set_name): + """ + Sets the backend_set_name of this PathRoute. + The name of the target backend set for requests where the incoming URI matches the specified path. + + Example: `My_backend_set` + + + :param backend_set_name: The backend_set_name of this PathRoute. + :type: str + """ + self._backend_set_name = backend_set_name + + @property + def path(self): + """ + **[Required]** Gets the path of this PathRoute. + The path string to match against the incoming URI path. + + * Path strings are case-insensitive. + + * Asterisk (*) wildcards are not supported. + + * Regular expressions are not supported. + + Example: `/example/video/123` + + + :return: The path of this PathRoute. + :rtype: str + """ + return self._path + + @path.setter + def path(self, path): + """ + Sets the path of this PathRoute. + The path string to match against the incoming URI path. + + * Path strings are case-insensitive. + + * Asterisk (*) wildcards are not supported. + + * Regular expressions are not supported. + + Example: `/example/video/123` + + + :param path: The path of this PathRoute. + :type: str + """ + self._path = path + + @property + def path_match_type(self): + """ + **[Required]** Gets the path_match_type of this PathRoute. + The type of matching to apply to incoming URIs. + + + :return: The path_match_type of this PathRoute. + :rtype: PathMatchType + """ + return self._path_match_type + + @path_match_type.setter + def path_match_type(self, path_match_type): + """ + Sets the path_match_type of this PathRoute. + The type of matching to apply to incoming URIs. + + + :param path_match_type: The path_match_type of this PathRoute. + :type: PathMatchType + """ + self._path_match_type = path_match_type + + 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/load_balancer/models/path_route_set.py b/src/oci/load_balancer/models/path_route_set.py new file mode 100644 index 0000000000..55fc6b7340 --- /dev/null +++ b/src/oci/load_balancer/models/path_route_set.py @@ -0,0 +1,101 @@ +# 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 PathRouteSet(object): + + def __init__(self, **kwargs): + """ + Initializes a new PathRouteSet object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param name: + The value to assign to the name property of this PathRouteSet. + :type name: str + + :param path_routes: + The value to assign to the path_routes property of this PathRouteSet. + :type path_routes: list[PathRoute] + + """ + self.swagger_types = { + 'name': 'str', + 'path_routes': 'list[PathRoute]' + } + + self.attribute_map = { + 'name': 'name', + 'path_routes': 'pathRoutes' + } + + self._name = None + self._path_routes = None + + @property + def name(self): + """ + **[Required]** Gets the name of this PathRouteSet. + The unique name for this set of path route rules. Avoid entering confidential information. + + Example: `path-route-set-001` + + + :return: The name of this PathRouteSet. + :rtype: str + """ + return self._name + + @name.setter + def name(self, name): + """ + Sets the name of this PathRouteSet. + The unique name for this set of path route rules. Avoid entering confidential information. + + Example: `path-route-set-001` + + + :param name: The name of this PathRouteSet. + :type: str + """ + self._name = name + + @property + def path_routes(self): + """ + **[Required]** Gets the path_routes of this PathRouteSet. + The set of path route rules. + + + :return: The path_routes of this PathRouteSet. + :rtype: list[PathRoute] + """ + return self._path_routes + + @path_routes.setter + def path_routes(self, path_routes): + """ + Sets the path_routes of this PathRouteSet. + The set of path route rules. + + + :param path_routes: The path_routes of this PathRouteSet. + :type: list[PathRoute] + """ + self._path_routes = path_routes + + 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/load_balancer/models/path_route_set_details.py b/src/oci/load_balancer/models/path_route_set_details.py new file mode 100644 index 0000000000..95613c73af --- /dev/null +++ b/src/oci/load_balancer/models/path_route_set_details.py @@ -0,0 +1,66 @@ +# 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 PathRouteSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new PathRouteSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param path_routes: + The value to assign to the path_routes property of this PathRouteSetDetails. + :type path_routes: list[PathRoute] + + """ + self.swagger_types = { + 'path_routes': 'list[PathRoute]' + } + + self.attribute_map = { + 'path_routes': 'pathRoutes' + } + + self._path_routes = None + + @property + def path_routes(self): + """ + **[Required]** Gets the path_routes of this PathRouteSetDetails. + The set of path route rules. + + + :return: The path_routes of this PathRouteSetDetails. + :rtype: list[PathRoute] + """ + return self._path_routes + + @path_routes.setter + def path_routes(self, path_routes): + """ + Sets the path_routes of this PathRouteSetDetails. + The set of path route rules. + + + :param path_routes: The path_routes of this PathRouteSetDetails. + :type: list[PathRoute] + """ + self._path_routes = path_routes + + 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/load_balancer/models/update_listener_details.py b/src/oci/load_balancer/models/update_listener_details.py index d09436e428..30d40f3f3a 100644 --- a/src/oci/load_balancer/models/update_listener_details.py +++ b/src/oci/load_balancer/models/update_listener_details.py @@ -22,6 +22,10 @@ def __init__(self, **kwargs): The value to assign to the default_backend_set_name property of this UpdateListenerDetails. :type default_backend_set_name: str + :param path_route_set_name: + The value to assign to the path_route_set_name property of this UpdateListenerDetails. + :type path_route_set_name: str + :param port: The value to assign to the port property of this UpdateListenerDetails. :type port: int @@ -38,6 +42,7 @@ def __init__(self, **kwargs): self.swagger_types = { 'connection_configuration': 'ConnectionConfiguration', 'default_backend_set_name': 'str', + 'path_route_set_name': 'str', 'port': 'int', 'protocol': 'str', 'ssl_configuration': 'SSLConfigurationDetails' @@ -46,6 +51,7 @@ def __init__(self, **kwargs): self.attribute_map = { 'connection_configuration': 'connectionConfiguration', 'default_backend_set_name': 'defaultBackendSetName', + 'path_route_set_name': 'pathRouteSetName', 'port': 'port', 'protocol': 'protocol', 'ssl_configuration': 'sslConfiguration' @@ -53,6 +59,7 @@ def __init__(self, **kwargs): self._connection_configuration = None self._default_backend_set_name = None + self._path_route_set_name = None self._port = None self._protocol = None self._ssl_configuration = None @@ -105,6 +112,36 @@ def default_backend_set_name(self, default_backend_set_name): """ self._default_backend_set_name = default_backend_set_name + @property + def path_route_set_name(self): + """ + Gets the path_route_set_name of this UpdateListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :return: The path_route_set_name of this UpdateListenerDetails. + :rtype: str + """ + return self._path_route_set_name + + @path_route_set_name.setter + def path_route_set_name(self, path_route_set_name): + """ + Sets the path_route_set_name of this UpdateListenerDetails. + The name of the set of path-based routing rules, :class:`PathRouteSet`, + applied to this listener's traffic. + + Example: `path-route-set-001` + + + :param path_route_set_name: The path_route_set_name of this UpdateListenerDetails. + :type: str + """ + self._path_route_set_name = path_route_set_name + @property def port(self): """ diff --git a/src/oci/load_balancer/models/update_path_route_set_details.py b/src/oci/load_balancer/models/update_path_route_set_details.py new file mode 100644 index 0000000000..53fd9dfcc9 --- /dev/null +++ b/src/oci/load_balancer/models/update_path_route_set_details.py @@ -0,0 +1,66 @@ +# 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 UpdatePathRouteSetDetails(object): + + def __init__(self, **kwargs): + """ + Initializes a new UpdatePathRouteSetDetails object with values from values from keyword arguments. + The following keyword arguments are supported (corresponding to the getters/setters of this class): + + :param path_routes: + The value to assign to the path_routes property of this UpdatePathRouteSetDetails. + :type path_routes: list[PathRoute] + + """ + self.swagger_types = { + 'path_routes': 'list[PathRoute]' + } + + self.attribute_map = { + 'path_routes': 'pathRoutes' + } + + self._path_routes = None + + @property + def path_routes(self): + """ + **[Required]** Gets the path_routes of this UpdatePathRouteSetDetails. + The set of path route rules. + + + :return: The path_routes of this UpdatePathRouteSetDetails. + :rtype: list[PathRoute] + """ + return self._path_routes + + @path_routes.setter + def path_routes(self, path_routes): + """ + Sets the path_routes of this UpdatePathRouteSetDetails. + The set of path route rules. + + + :param path_routes: The path_routes of this UpdatePathRouteSetDetails. + :type: list[PathRoute] + """ + self._path_routes = path_routes + + 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/service_endpoints.py b/src/oci/service_endpoints.py index 6fc50b0e3f..392140d44a 100644 --- a/src/oci/service_endpoints.py +++ b/src/oci/service_endpoints.py @@ -7,6 +7,7 @@ "compute": "https://iaas.{domain}/20160918", "virtual_network": "https://iaas.{domain}/20160918", "database": "https://database.{domain}/20160918", + "dns": "https://dns.{domain}/20180115", "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 85074cac47..98327955d7 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.13" +__version__ = "1.3.14" diff --git a/src/oci/waiter.py b/src/oci/waiter.py index cb1f3c5f10..e31b9965b3 100644 --- a/src/oci/waiter.py +++ b/src/oci/waiter.py @@ -5,6 +5,7 @@ from .exceptions import MaximumWaitTimeExceeded, WaitUntilNotSupported, ServiceError from .util import Sentinel +from . import retry WAIT_RESOURCE_NOT_FOUND = Sentinel(name='WaitResourceNotFound', truthy=False) @@ -96,7 +97,7 @@ def wait_until(client, response, property=None, state=None, max_interval_seconds sleep_interval_seconds = min(sleep_interval_seconds * 2, max_interval_seconds) try: - response = client.base_client.request(response.request) + response = retry.DEFAULT_RETRY_STRATEGY.make_retrying_call(client.base_client.request, response.request) times_checked += 1 except ServiceError as se: if se.status == 404: diff --git a/tests/conftest.py b/tests/conftest.py index 5d16f17983..60c1a4806d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -110,6 +110,13 @@ def database_client(config): return client +@pytest.fixture +def dns_client(config): + client = oci.dns.DnsClient(config) + add_retries_to_service_operations(client) + return client + + def add_retries_to_service_operations(client_obj): for name in dir(client_obj): if name.find('__') == 0: diff --git a/tests/integ/util.py b/tests/integ/util.py index 87d6c85619..cfc77f1ffc 100644 --- a/tests/integ/util.py +++ b/tests/integ/util.py @@ -56,9 +56,14 @@ def init_availability_domain_variables(identity_api, tenant_id): first_ad = availability_domains[0].name second_ad = availability_domains[1].name else: - chosen_domains = random.sample(availability_domains, 2) - first_ad = chosen_domains[0].name - second_ad = chosen_domains[1].name + # We need consistency in the vended availability domains if we're mocking, so don't randomize + if test_config_container.using_vcr_with_mock_responses(): + first_ad = availability_domains[0].name + second_ad = availability_domains[1].name + else: + chosen_domains = random.sample(availability_domains, 2) + first_ad = chosen_domains[0].name + second_ad = chosen_domains[1].name def bucket_prefix(): diff --git a/tests/unit/test_basic_api_calls.py b/tests/unit/test_basic_api_calls.py index 66ef87597b..f53682563f 100644 --- a/tests/unit/test_basic_api_calls.py +++ b/tests/unit/test_basic_api_calls.py @@ -2,6 +2,8 @@ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. import oci +import pytest +import requests def test_identity_list_users(identity, config): @@ -38,3 +40,21 @@ def test_limit(identity, config): assert type(response.data[0]) is oci.identity.models.User assert response.status == 200 assert response.request_id is not None + + +def test_api_call_with_explicit_timeout(config): + client = oci.identity.IdentityClient(config) + client.base_client.timeout = 0.01 # 0.01s timeout on connection and read. Should be too short to connect without timing out + + with pytest.raises(requests.exceptions.ConnectTimeout) as e: + client.list_users(config['tenancy']) + assert 'connect timeout=0.01' in str(e) + + client.base_client.timeout = (0.05, 25) # 0.05s timeout on connection, 25s on read. Should be too short to connect without timing out + with pytest.raises(requests.exceptions.ConnectTimeout) as e: + client.list_users(config['tenancy']) + assert 'connect timeout=0.05' in str(e) + + client.base_client.timeout = 5 + response = client.list_users(config['tenancy']) + assert len(response.data) > 0